private ConfigData LoadConfig(out string selectedName) { selectedName = base.Request.Form["ddlPayments"]; this.txtSelectedName.Value = selectedName; this.txtConfigData.Value = ""; if (string.IsNullOrEmpty(selectedName) || (selectedName.Length == 0)) { return(null); } ConfigablePlugin plugin = PaymentRequest.CreateInstance(selectedName); if (plugin == null) { return(null); } ConfigData configData = plugin.GetConfigData(base.Request.Form); if (configData != null) { this.txtConfigData.Value = configData.SettingsXml; } return(configData); }
protected void btnSubmit_Click(object sender, EventArgs e) { string text = this.txtBankCode.Value.Trim(); if (string.IsNullOrEmpty(text) || this.paymode.Gateway.ToLower() != "hishop.plugins.payment.alipay_bank.bankrequest") { base.Response.Redirect("SendPayment.aspx?OrderId=" + this.order.OrderId); } else { string showUrl = base.Server.UrlEncode($"http://{base.Request.Url.Host}/user/OrderDetails.aspx?OrderId={this.order.OrderId}"); string hIGW = this.paymode.Gateway.Replace(".", "_"); string orderId = this.order.OrderId + new Random().Next(10000, 99999).ToString(); PaymentRequest paymentRequest = PaymentRequest.CreateInstance(this.paymode.Gateway, HiCryptographer.Decrypt(this.paymode.Settings), orderId, this.GetPayMoney(this.order), "订单支付", "订单号-" + this.order.OrderId, this.order.EmailAddress, this.order.OrderDate, showUrl, Globals.FullPath(base.GetRouteUrl("PaymentReturn_url", new { HIGW = hIGW })), Globals.FullPath(base.GetRouteUrl("PaymentNotify_url", new { HIGW = hIGW })), text); paymentRequest.SendRequest(); } }
private void btnConfirm_Click(object sender, EventArgs e) { PaymentModeInfo paymentMode = TradeHelper.GetPaymentMode(this.paymentModeId); InpourRequestInfo info3 = new InpourRequestInfo(); info3.InpourId = this.GenerateInpourId(); info3.TradeDate = DateTime.Now; info3.InpourBlance = this.balance; info3.UserId = HiContext.Current.User.UserId; info3.PaymentId = paymentMode.ModeId; InpourRequestInfo inpourRequest = info3; if (PersonalHelper.AddInpourBlance(inpourRequest)) { string attach = ""; HttpCookie cookie = HiContext.Current.Context.Request.Cookies["Token_" + HiContext.Current.User.UserId.ToString()]; if ((cookie != null) && !string.IsNullOrEmpty(cookie.Value)) { attach = cookie.Value; } string orderId = inpourRequest.InpourId.ToString(CultureInfo.InvariantCulture); PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderId, inpourRequest.InpourBlance + ((decimal)this.ViewState["PayCharge"]), "预付款充值", "操作流水号-" + orderId, HiContext.Current.User.Email, inpourRequest.TradeDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("InpourReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("InpourNotify_url", new object[] { paymentMode.Gateway })), attach).SendRequest(); } }
private void btnSendGoods_Click(object sender, EventArgs e) { OrderInfo orderInfo = OrderHelper.GetOrderInfo(this.orderId); if (orderInfo != null) { if ((orderInfo.GroupBuyId > 0) && (orderInfo.GroupBuyStatus != GroupBuyStatus.Success)) { this.ShowMsg("当前订单为团购订单,团购活动还未成功结束,所以不能发货", false); } else if (!orderInfo.CheckAction(OrderActions.SELLER_SEND_GOODS)) { this.ShowMsg("当前订单状态没有付款或不是等待发货的订单,所以不能发货", false); } else if (!this.radioShippingMode.SelectedValue.HasValue) { this.ShowMsg("请选择配送方式", false); } else if (string.IsNullOrEmpty(this.txtShipOrderNumber.Text.Trim()) || (this.txtShipOrderNumber.Text.Trim().Length > 20)) { this.ShowMsg("运单号码不能为空,在1至20个字符之间", false); } else if (string.IsNullOrEmpty(this.expressRadioButtonList.SelectedValue)) { this.ShowMsg("请选择物流公司", false); } else { ShippingModeInfo shippingMode = SalesHelper.GetShippingMode(this.radioShippingMode.SelectedValue.Value, true); orderInfo.RealShippingModeId = this.radioShippingMode.SelectedValue.Value; orderInfo.RealModeName = shippingMode.Name; ExpressCompanyInfo info3 = ExpressHelper.FindNode(this.expressRadioButtonList.SelectedValue); if (info3 != null) { orderInfo.ExpressCompanyAbb = info3.Kuaidi100Code; orderInfo.ExpressCompanyName = info3.Name; } orderInfo.ShipOrderNumber = this.txtShipOrderNumber.Text; if (OrderHelper.SendGoods(orderInfo)) { SendNote note = new SendNote(); note.NoteId = Globals.GetGenerateId(); note.OrderId = this.orderId; note.Operator = HiContext.Current.User.Username; note.Remark = "后台" + note.Operator + "发货成功"; OrderHelper.SaveSendNote(note); if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && (orderInfo.GatewayOrderId.Trim().Length > 0)) { PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.PaymentTypeId); if (paymentMode != null) { PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[] { paymentMode.Gateway })), "").SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS"); } } int userId = orderInfo.UserId; if (userId == 0x44c) { userId = 0; } IUser user = Users.GetUser(userId); Messenger.OrderShipping(orderInfo, user); orderInfo.OnDeliver(); this.ShowMsg("发货成功", true); } else { this.ShowMsg("发货失败", false); } } } }
private void btnSendGoods_Click(object sender, EventArgs e) { if (this.grdOrderGoods.Items.Count <= 0) { this.ShowMsg("没有要进行发货的订单。", false); } else { StringBuilder stringBuilder = new StringBuilder(); SiteSettings masterSettings = SettingsManager.GetMasterSettings(); int num = 0; for (int i = 0; i < this.grdOrderGoods.Items.Count; i++) { HiddenField hiddenField = (HiddenField)this.grdOrderGoods.Items[i].FindControl("hidorderId"); string value = hiddenField.Value; TextBox textBox = (TextBox)this.grdOrderGoods.Items[i].FindControl("txtShippOrderNumber"); ExpressDropDownList expressDropDownList = this.grdOrderGoods.Items[i].FindControl("expressList1") as ExpressDropDownList; OrderInfo orderInfo = OrderHelper.GetOrderInfo(value); if ((orderInfo.GroupBuyId <= 0 || orderInfo.GroupBuyStatus == GroupBuyStatus.Success) && ((orderInfo.OrderStatus == OrderStatus.WaitBuyerPay && orderInfo.Gateway == "hishop.plugins.payment.podrequest") || orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid)) { ExpressCompanyInfo expressCompanyInfo = null; if (!string.IsNullOrEmpty(expressDropDownList.SelectedValue)) { expressCompanyInfo = ExpressHelper.FindNode(expressDropDownList.SelectedValue); } if (expressCompanyInfo != null) { if (!string.IsNullOrEmpty(orderInfo.OuterOrderId) && orderInfo.OuterOrderId.StartsWith("jd_") && string.IsNullOrWhiteSpace(expressCompanyInfo.JDCode)) { continue; } orderInfo.ExpressCompanyName = expressCompanyInfo.Name; orderInfo.ExpressCompanyAbb = expressCompanyInfo.Kuaidi100Code; orderInfo.ShipOrderNumber = textBox.Text; } if (OrderHelper.SendGoods(orderInfo) && expressCompanyInfo != null && !string.IsNullOrEmpty(orderInfo.ExpressCompanyAbb) && orderInfo.ExpressCompanyAbb.ToUpper() == "HTKY") { ExpressHelper.GetDataByKuaidi100(orderInfo.ExpressCompanyAbb, orderInfo.ShipOrderNumber); } if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && orderInfo.GatewayOrderId.Trim().Length > 0) { PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.Gateway); if (paymentMode != null) { string hIGW = paymentMode.Gateway.Replace(".", "_"); PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.PayOrderId, orderInfo.GetTotal(false), "订单发货", "订单号-" + orderInfo.PayOrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(""), Globals.FullPath(base.GetRouteUrl("PaymentReturn_url", new { HIGW = hIGW })), Globals.FullPath(base.GetRouteUrl("PaymentNotify_url", new { HIGW = hIGW })), ""); paymentRequest.SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS"); } } if (!string.IsNullOrEmpty(orderInfo.OuterOrderId) && expressCompanyInfo != null) { if (orderInfo.OuterOrderId.StartsWith("tb_")) { string text = orderInfo.OuterOrderId.Replace("tb_", ""); try { string requestUriString = $"http://order2.kuaidiangtong.com/UpdateShipping.ashx?tid={text}&companycode={expressCompanyInfo.TaobaoCode}&outsid={orderInfo.ShipOrderNumber}&Host={HiContext.Current.SiteUrl}"; WebRequest webRequest = WebRequest.Create(requestUriString); webRequest.GetResponse(); } catch { } } else if (orderInfo.OuterOrderId.StartsWith("jd_") && expressCompanyInfo != null) { string text = orderInfo.OuterOrderId.Replace("jd_", ""); try { JDHelper.JDOrderOutStorage(masterSettings.JDAppKey, masterSettings.JDAppSecret, masterSettings.JDAccessToken, expressCompanyInfo.JDCode, orderInfo.ShipOrderNumber, text); } catch (Exception ex) { stringBuilder.Append($"订单:{orderInfo.OrderId}同步京东发货失败,京东订单号:{text},{ex.Message}\r\n"); } } } int num2 = orderInfo.UserId; if (num2 == 1100) { num2 = 0; } MemberInfo user = Users.GetUser(num2); Messenger.OrderShipping(orderInfo, user); orderInfo.OnDeliver(); num++; } } if (num == 0) { this.ShowMsg("批量发货失败,您填写的信息不完整!", false); } else if (num > 0) { this.ShowMsgCloseWindow(string.Format("批量发货成功!发货数量{0}个!{1}", num, (stringBuilder.Length > 0) ? stringBuilder.ToString() : ""), true); } } }
protected void Page_Load(object sender, System.EventArgs e) { if (Globals.RequestQueryStr("type") == "saveorders") { this.type = "saveorders"; } string text = Globals.RequestFormStr("posttype"); this.orderIds = Globals.RequestQueryStr("OrderId").Trim(new char[] { ',' }); if (string.IsNullOrEmpty(this.ReUrl)) { this.ReUrl = "manageorder.aspx"; } string a; if ((a = text) != null) { if (a == "saveorders") { string text2 = Globals.RequestFormStr("data"); base.Response.ContentType = "application/json"; string s = "{\"type\":\"0\",\"tips\":\"指定物流失败!\"}"; JArray jArray = (JArray)JsonConvert.DeserializeObject(text2); string text3 = string.Empty; if (jArray != null) { if (jArray.Count > 1) { text3 = "批量"; } bool flag = true; using (System.Collections.Generic.IEnumerator <JToken> enumerator = jArray.GetEnumerator()) { while (enumerator.MoveNext()) { JObject jObject = (JObject)enumerator.Current; if (!this.CheckOrderCompany(jObject["orderid"].ToString(), jObject["companycode"].ToString(), jObject["compname"].ToString(), jObject["shipordernumber"].ToString())) { flag = false; } } } if (flag) { using (System.Collections.Generic.IEnumerator <JToken> enumerator2 = jArray.GetEnumerator()) { while (enumerator2.MoveNext()) { JObject jObject2 = (JObject)enumerator2.Current; OrderHelper.UpdateOrderCompany(jObject2["orderid"].ToString(), jObject2["companycode"].ToString(), jObject2["compname"].ToString(), jObject2["shipordernumber"].ToString()); } } s = "{\"type\":\"1\",\"tips\":\"" + text3 + "指定物流成功!\"}"; } else { s = "{\"type\":\"0\",\"tips\":\"" + text3 + "指定物流失败,请检测数据的正确性!\"}"; } } base.Response.Write(s); base.Response.End(); return; } if (a == "saveoneorders") { string text2 = Globals.RequestFormStr("data"); base.Response.ContentType = "application/json"; string s = "{\"type\":\"0\",\"tips\":\"指定物流失败!\"}"; JArray jArray = (JArray)JsonConvert.DeserializeObject(text2); string text3 = string.Empty; if (jArray != null) { bool flag2 = true; string shipNumber = "1111111111"; using (System.Collections.Generic.IEnumerator <JToken> enumerator3 = jArray.GetEnumerator()) { while (enumerator3.MoveNext()) { JObject jObject3 = (JObject)enumerator3.Current; if (!this.CheckOrderCompany(jObject3["orderid"].ToString(), jObject3["companycode"].ToString(), jObject3["compname"].ToString(), shipNumber)) { flag2 = false; } } } if (flag2) { using (System.Collections.Generic.IEnumerator <JToken> enumerator4 = jArray.GetEnumerator()) { while (enumerator4.MoveNext()) { JObject jObject4 = (JObject)enumerator4.Current; OrderHelper.UpdateOrderCompany(jObject4["orderid"].ToString(), jObject4["companycode"].ToString(), jObject4["compname"].ToString(), ""); } } s = "{\"type\":\"1\",\"tips\":\"" + text3 + "指定物流成功!\"}"; } else { s = "{\"type\":\"0\",\"tips\":\"" + text3 + "指定物流失败,请检测数据的正确性!\"}"; } } base.Response.Write(s); base.Response.End(); return; } if (a == "sendorders") { string text2 = Globals.RequestFormStr("data"); base.Response.ContentType = "application/json"; string s = "{\"type\":\"0\",\"tips\":\"发货失败!\"}"; JArray jArray = (JArray)JsonConvert.DeserializeObject(text2); string text3 = string.Empty; if (jArray != null) { if (jArray.Count > 1) { text3 = "批量"; } bool flag3 = true; using (System.Collections.Generic.IEnumerator <JToken> enumerator5 = jArray.GetEnumerator()) { while (enumerator5.MoveNext()) { JObject jObject5 = (JObject)enumerator5.Current; if (!this.CheckOrderCompany(jObject5["orderid"].ToString(), jObject5["companycode"].ToString(), jObject5["compname"].ToString(), jObject5["shipordernumber"].ToString())) { flag3 = false; } } } if (flag3) { int num = 0; using (System.Collections.Generic.IEnumerator <JToken> enumerator6 = jArray.GetEnumerator()) { while (enumerator6.MoveNext()) { JObject jObject6 = (JObject)enumerator6.Current; OrderInfo orderInfo = OrderHelper.GetOrderInfo(jObject6["orderid"].ToString()); if ((orderInfo.GroupBuyId <= 0 || orderInfo.GroupBuyStatus == GroupBuyStatus.Success) && ((orderInfo.OrderStatus == OrderStatus.WaitBuyerPay && orderInfo.Gateway == "hishop.plugins.payment.podrequest") || orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid) && !string.IsNullOrEmpty(jObject6["shipordernumber"].ToString().Trim()) && jObject6["shipordernumber"].ToString().Trim().Length <= 30) { orderInfo.ExpressCompanyAbb = jObject6["companycode"].ToString(); orderInfo.ExpressCompanyName = jObject6["compname"].ToString(); orderInfo.ShipOrderNumber = jObject6["shipordernumber"].ToString(); if (OrderHelper.SendGoods(orderInfo)) { Express.SubscribeExpress100(jObject6["companycode"].ToString(), jObject6["shipordernumber"].ToString()); SendNoteInfo sendNoteInfo = new SendNoteInfo(); sendNoteInfo.NoteId = Globals.GetGenerateId() + num; sendNoteInfo.OrderId = jObject6["orderid"].ToString(); sendNoteInfo.Operator = ManagerHelper.GetCurrentManager().UserName; sendNoteInfo.Remark = "后台" + sendNoteInfo.Operator + "发货成功"; OrderHelper.SaveSendNote(sendNoteInfo); if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && orderInfo.GatewayOrderId.Trim().Length > 0) { if (orderInfo.Gateway == "hishop.plugins.payment.ws_wappay.wswappayrequest") { PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.PaymentTypeId); if (paymentMode != null) { PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[] { paymentMode.Gateway })), ""); paymentRequest.SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS"); } } if (orderInfo.Gateway == "hishop.plugins.payment.weixinrequest") { SiteSettings masterSettings = SettingsManager.GetMasterSettings(false); PayClient payClient; if (masterSettings.EnableSP) { payClient = new PayClient(masterSettings.Main_AppId, masterSettings.WeixinAppSecret, masterSettings.Main_Mch_ID, masterSettings.Main_PayKey, true, masterSettings.WeixinAppId, masterSettings.WeixinPartnerID); } else { payClient = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, false, "", ""); } payClient.DeliverNotify(new DeliverInfo { TransId = orderInfo.GatewayOrderId, OutTradeNo = orderInfo.OrderId, OpenId = MemberHelper.GetMember(orderInfo.UserId).OpenId }); } } orderInfo.OnDeliver(); num++; } } } } if (num == 0) { s = "{\"type\":\"0\",\"tips\":\"" + text3 + "发货失败!\"}"; } else { s = string.Concat(new object[] { "{\"type\":\"1\",\"tips\":\"", text3, "发货成功!发货数量", num, "个\"}" }); } } else { s = "{\"type\":\"0\",\"tips\":\"" + text3 + "发货失败,请检测数据的正确性!\"}"; } } base.Response.Write(s); base.Response.End(); return; } if (a == "getcompany") { base.Response.ContentType = "application/json"; string text2 = "[{\"type\":\"0\",\"data\":[]}]"; System.Collections.Generic.IList <ExpressCompanyInfo> allExpress = ExpressHelper.GetAllExpress(); int num2 = 0; System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); foreach (ExpressCompanyInfo current in allExpress) { if (num2 == 0) { stringBuilder.Append(string.Concat(new string[] { "{\"code\":\"", SendOrderGoods.String2Json(current.Kuaidi100Code), "\",\"name\":\"", SendOrderGoods.String2Json(current.Name), "\"}" })); } else { stringBuilder.Append(string.Concat(new string[] { ",{\"code\":\"", SendOrderGoods.String2Json(current.Kuaidi100Code), "\",\"name\":\"", SendOrderGoods.String2Json(current.Name), "\"}" })); } num2++; } if (!string.IsNullOrEmpty(stringBuilder.ToString())) { text2 = "[{\"type\":\"1\",\"data\":[" + stringBuilder.ToString() + "]}]"; } base.Response.Write(text2); base.Response.End(); return; } } if (string.IsNullOrEmpty(this.orderIds)) { base.GotoResourceNotFound(); return; } string[] array = this.orderIds.Split(new char[] { ',' }); bool flag4 = true; string[] array2 = array; for (int i = 0; i < array2.Length; i++) { string lstr = array2[i]; if (!Globals.IsOrdersID(lstr)) { flag4 = false; break; } } if (flag4) { System.Data.DataSet ordersByOrderIDList = OrderHelper.GetOrdersByOrderIDList(this.orderIds); this.rptItemList.DataSource = ordersByOrderIDList; this.rptItemList.DataBind(); this.litOrdersCount.Text = ordersByOrderIDList.Tables[0].Rows.Count.ToString(); return; } base.Response.Write("非法参数请求!"); base.Response.End(); }
protected void btnSubmit_Click(object sender, System.EventArgs e) { SiteSettings masterSettings = SettingsManager.GetMasterSettings(false); for (int i = 0; i < this.Orders.Rows.Count; i++) { OrderInfo orderInfo = OrderHelper.GetOrderInfo(this.Orders.Rows[i]["OrderId"].ToString()); if (orderInfo != null) { ManagerInfo currentManager = ManagerHelper.GetCurrentManager();//获取目前的管理员信息 if (orderInfo.GroupBuyId > 0 && orderInfo.GroupBuyStatus != GroupBuyStatus.Success) { this.ShowMsg("当前订单为团购订单,团购活动还未成功结束,所以不能发货", false); } else { if (!orderInfo.CheckAction(OrderActions.SELLER_SEND_GOODS)) { this.ShowMsg("当前订单状态没有付款或不是等待发货的订单,所以不能发货", false); } else { orderInfo.RealShippingModeId = 1;//固定为1,为第一种快递方式(店家初始化时自己配置的第一种方式是什么这里就是什么) orderInfo.RealModeName = "快速收银"; orderInfo.ShipOrderNumber = ""; if (OrderHelper.SendGoods(orderInfo)) { SendNoteInfo info5 = new SendNoteInfo(); info5.NoteId = Globals.GetGenerateId(); info5.OrderId = orderInfo.OrderId; info5.Operator = currentManager.UserName; info5.Remark = "后台" + info5.Operator + "发货成功"; OrderHelper.SaveSendNote(info5); MemberInfo member = MemberHelper.GetMember(orderInfo.UserId); Messenger.OrderShipping(orderInfo, member); if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && orderInfo.GatewayOrderId.Trim().Length > 0) { if (orderInfo.Gateway == "hishop.plugins.payment.ws_wappay.wswappayrequest") { PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.PaymentTypeId); if (paymentMode != null) { PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[] { paymentMode.Gateway })), "").SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS"); } } if (orderInfo.Gateway == "hishop.plugins.payment.weixinrequest") { //SiteSettings masterSettings = SettingsManager.GetMasterSettings(false); PayClient client = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, masterSettings.WeixinPaySignKey); DeliverInfo deliver = new DeliverInfo { TransId = orderInfo.GatewayOrderId, OutTradeNo = orderInfo.OrderId, OpenId = MemberHelper.GetMember(orderInfo.UserId).OpenId }; client.DeliverNotify(deliver); } } orderInfo.OnDeliver(); //this.ShowMsg("发货成功", true); //发送成功后,确认收货 bool flag = false; orderInfo = ShoppingProcessor.GetOrderInfo(this.Orders.Rows[i]["OrderId"].ToString()); Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems; LineItemInfo lineItemInfo = new LineItemInfo(); foreach (KeyValuePair <string, LineItemInfo> lineItem in lineItems) { lineItemInfo = lineItem.Value; if (lineItemInfo.OrderItemsStatus != OrderStatus.ApplyForRefund && lineItemInfo.OrderItemsStatus != OrderStatus.ApplyForReturns) { continue; } flag = true; } if (flag) { Response.Write("<script>alert('订单中商品有退货(款)不允许完成');</script>"); return; } if (orderInfo == null || !MemberProcessor.ConfirmOrderFinish(orderInfo)) { Response.Write("<script>alert('订单当前状态不允许完成');</script>"); return; } DistributorsBrower.UpdateCalculationCommission(orderInfo);//增加佣金记录、更新分销商的有效推广佣金和订单总额 MemberInfo currentMember = MemberProcessor.GetMember(orderInfo.UserId); int num = 0; if (masterSettings.IsRequestDistributor && !string.IsNullOrEmpty(masterSettings.FinishedOrderMoney.ToString()) && currentMember.Expenditure >= masterSettings.FinishedOrderMoney) { num = 1; } foreach (LineItemInfo value in orderInfo.LineItems.Values) { if (value.OrderItemsStatus.ToString() != OrderStatus.SellerAlreadySent.ToString()) { continue; } ShoppingProcessor.UpdateOrderGoodStatu(orderInfo.OrderId, value.SkuId, 5); } DistributorsInfo distributorsInfo = new DistributorsInfo(); distributorsInfo = DistributorsBrower.GetUserIdDistributors(orderInfo.UserId); if (distributorsInfo != null && distributorsInfo.UserId > 0) { num = 0; } this.Orders.Clear(); dlstOrders.DataSource = this.Orders; dlstOrders.DataBind(); this.ShowMsg("收银成功", true); } else { this.ShowMsg("发货失败", false); } } } } } }
private void btnSendGoods_Click(object sender, System.EventArgs e) { OrderInfo orderInfo = OrderHelper.GetOrderInfo(this.orderId); if (orderInfo == null) { return; } if (orderInfo.GroupBuyId > 0 && orderInfo.GroupBuyStatus != GroupBuyStatus.Success) { this.ShowMsg("当前订单为团购订单,团购活动还未成功结束,所以不能发货", false); return; } if (!orderInfo.CheckAction(OrderActions.SELLER_SEND_GOODS)) { this.ShowMsg("当前订单状态没有付款或不是等待发货的订单,所以不能发货", false); return; } if (!this.radioShippingMode.SelectedValue.HasValue) { this.ShowMsg("请选择配送方式", false); return; } if (string.IsNullOrEmpty(this.txtShipOrderNumber.Text.Trim()) || this.txtShipOrderNumber.Text.Trim().Length > 20) { this.ShowMsg("运单号码不能为空,在1至20个字符之间", false); return; } if (string.IsNullOrEmpty(this.expressRadioButtonList.SelectedValue)) { this.ShowMsg("请选择物流公司", false); return; } ShippingModeInfo shippingMode = SalesHelper.GetShippingMode(this.radioShippingMode.SelectedValue.Value, true); orderInfo.RealShippingModeId = this.radioShippingMode.SelectedValue.Value; orderInfo.RealModeName = shippingMode.Name; orderInfo.ShippingModeId = this.radioShippingMode.SelectedValue.Value; orderInfo.ModeName = shippingMode.Name; ExpressCompanyInfo expressCompanyInfo = ExpressHelper.FindNode(this.expressRadioButtonList.SelectedValue); if (expressCompanyInfo != null) { orderInfo.ExpressCompanyAbb = expressCompanyInfo.Kuaidi100Code; orderInfo.ExpressCompanyName = expressCompanyInfo.Name; } orderInfo.ShipOrderNumber = this.txtShipOrderNumber.Text; orderInfo.ShippingDate = DateTime.Now; if (OrderHelper.SendGoods(orderInfo)) { SendNoteInfo sendNoteInfo = new SendNoteInfo(); sendNoteInfo.NoteId = Globals.GetGenerateId(); sendNoteInfo.OrderId = this.orderId; sendNoteInfo.Operator = HiContext.Current.User.Username; sendNoteInfo.Remark = "后台" + sendNoteInfo.Operator + "发货成功"; OrderHelper.SaveSendNote(sendNoteInfo); if (orderInfo.Gateway == "Ecdev.plugins.payment.weixinrequest") { SiteSettings masterSettings = SettingsManager.GetMasterSettings(false); PayClient payClient = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, masterSettings.WeixinPaySignKey); payClient.DeliverNotify(new DeliverInfo { TransId = orderInfo.GatewayOrderId, OutTradeNo = orderInfo.OrderId, OpenId = MemberHelper.GetMember(orderInfo.UserId).OpenId }); } else { if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && orderInfo.GatewayOrderId.Trim().Length > 0) { PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.Gateway); if (paymentMode != null && !string.IsNullOrEmpty(paymentMode.Settings) && paymentMode.Settings != "1hSUSkKQ/ENo0JDZah8KKQweixin") { PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[] { paymentMode.Gateway })), ""); paymentRequest.SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS"); } } if (!string.IsNullOrEmpty(orderInfo.TaobaoOrderId)) { try { string requestUriString = string.Format("http://vip.ecdev.cn/UpdateShipping.ashx?tid={0}&companycode={1}&outsid={2}&Host={3}", new object[] { orderInfo.TaobaoOrderId, expressCompanyInfo.TaobaoCode, orderInfo.ShipOrderNumber, HiContext.Current.SiteUrl }); System.Net.WebRequest webRequest = System.Net.WebRequest.Create(requestUriString); webRequest.GetResponse(); } catch { } } } int num = orderInfo.UserId; if (num == 1100) { num = 0; } IUser user = Users.GetUser(num); Messenger.OrderShipping(orderInfo, user); orderInfo.OnDeliver(); //this.ShowMsg("发货成功", true); this.CloseWindow(); return; } this.ShowMsg("发货失败", false); }
protected void Page_Load(object sender, EventArgs e) { string str2; string str3; JArray array; string str4; if (Globals.RequestQueryStr("type") == "saveorders") { this.type = "saveorders"; } string str = Globals.RequestFormStr("posttype"); this.orderIds = Globals.RequestQueryStr("OrderId").Trim(new char[] { ',' }); if (string.IsNullOrEmpty(this.ReUrl)) { this.ReUrl = "manageorder.aspx"; } switch (str) { case "saveorders": str2 = Globals.RequestFormStr("data"); base.Response.ContentType = "application/json"; str3 = "{\"type\":\"0\",\"tips\":\"指定物流失败!\"}"; array = (JArray)JsonConvert.DeserializeObject(str2); str4 = string.Empty; if (array != null) { if (array.Count > 1) { str4 = "批量"; } bool flag = true; foreach (JObject obj2 in array) { if (!this.CheckOrderCompany(obj2["orderid"].ToString(), obj2["companycode"].ToString(), obj2["compname"].ToString(), obj2["shipordernumber"].ToString())) { flag = false; } } if (flag) { foreach (JObject obj3 in array) { OrderHelper.UpdateOrderCompany(obj3["orderid"].ToString(), obj3["companycode"].ToString(), obj3["compname"].ToString(), obj3["shipordernumber"].ToString()); } str3 = "{\"type\":\"1\",\"tips\":\"" + str4 + "指定物流成功!\"}"; } else { str3 = "{\"type\":\"0\",\"tips\":\"" + str4 + "指定物流失败,请检测数据的正确性!\"}"; } } base.Response.Write(str3); base.Response.End(); return; case "saveoneorders": str2 = Globals.RequestFormStr("data"); base.Response.ContentType = "application/json"; str3 = "{\"type\":\"0\",\"tips\":\"指定物流失败!\"}"; array = (JArray)JsonConvert.DeserializeObject(str2); str4 = string.Empty; if (array != null) { bool flag2 = true; string shipNumber = "1111111111"; foreach (JObject obj4 in array) { if (!this.CheckOrderCompany(obj4["orderid"].ToString(), obj4["companycode"].ToString(), obj4["compname"].ToString(), shipNumber)) { flag2 = false; } } if (flag2) { foreach (JObject obj5 in array) { OrderHelper.UpdateOrderCompany(obj5["orderid"].ToString(), obj5["companycode"].ToString(), obj5["compname"].ToString(), ""); } str3 = "{\"type\":\"1\",\"tips\":\"" + str4 + "指定物流成功!\"}"; } else { str3 = "{\"type\":\"0\",\"tips\":\"" + str4 + "指定物流失败,请检测数据的正确性!\"}"; } } base.Response.Write(str3); base.Response.End(); return; case "sendorders": str2 = Globals.RequestFormStr("data"); base.Response.ContentType = "application/json"; str3 = "{\"type\":\"0\",\"tips\":\"发货失败!\"}"; array = (JArray)JsonConvert.DeserializeObject(str2); str4 = string.Empty; if (array != null) { if (array.Count > 1) { str4 = "批量"; } bool flag3 = true; foreach (JObject obj6 in array) { if (!this.CheckOrderCompany(obj6["orderid"].ToString(), obj6["companycode"].ToString(), obj6["compname"].ToString(), obj6["shipordernumber"].ToString())) { flag3 = false; } } if (flag3) { int num = 0; foreach (JObject obj7 in array) { OrderInfo orderInfo = OrderHelper.GetOrderInfo(obj7["orderid"].ToString()); if ((((orderInfo.GroupBuyId <= 0) || (orderInfo.GroupBuyStatus == GroupBuyStatus.Success)) && (((orderInfo.OrderStatus == OrderStatus.WaitBuyerPay) && (orderInfo.Gateway == "hishop.plugins.payment.podrequest")) || (orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid))) && (!string.IsNullOrEmpty(obj7["shipordernumber"].ToString().Trim()) && (obj7["shipordernumber"].ToString().Trim().Length <= 30))) { orderInfo.ExpressCompanyAbb = obj7["companycode"].ToString(); orderInfo.ExpressCompanyName = obj7["compname"].ToString(); orderInfo.ShipOrderNumber = obj7["shipordernumber"].ToString(); if (OrderHelper.SendGoods(orderInfo)) { SendNoteInfo info2 = new SendNoteInfo(); Express.SubscribeExpress100(obj7["companycode"].ToString(), obj7["shipordernumber"].ToString()); info2 = new SendNoteInfo { NoteId = Globals.GetGenerateId() + num, OrderId = obj7["orderid"].ToString(), Operator = ManagerHelper.GetCurrentManager().UserName, Remark = "后台" + info2.Operator + "发货成功" }; OrderHelper.SaveSendNote(info2); if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && (orderInfo.GatewayOrderId.Trim().Length > 0)) { if (orderInfo.Gateway == "hishop.plugins.payment.ws_wappay.wswappayrequest") { PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.PaymentTypeId); if (paymentMode != null) { PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[] { paymentMode.Gateway })), "").SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS"); } } if (orderInfo.Gateway == "hishop.plugins.payment.weixinrequest") { PayClient client; SiteSettings masterSettings = SettingsManager.GetMasterSettings(false); if (masterSettings.EnableSP) { client = new PayClient(masterSettings.Main_AppId, masterSettings.WeixinAppSecret, masterSettings.Main_Mch_ID, masterSettings.Main_PayKey, true, masterSettings.WeixinAppId, masterSettings.WeixinPartnerID); } else { client = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, false, "", ""); } DeliverInfo deliver = new DeliverInfo { TransId = orderInfo.GatewayOrderId, OutTradeNo = orderInfo.OrderId, OpenId = MemberHelper.GetMember(orderInfo.UserId).OpenId }; client.DeliverNotify(deliver); } } orderInfo.OnDeliver(); num++; } } } if (num == 0) { str3 = "{\"type\":\"0\",\"tips\":\"" + str4 + "发货失败!\"}"; } else { str3 = "{\"type\":\"1\",\"tips\":\"" + num + "个订单发货成功!\"}"; } } else { str3 = "{\"type\":\"0\",\"tips\":\"" + str4 + "发货失败,请检测数据的正确性!\"}"; } } base.Response.Write(str3); base.Response.End(); return; case "getcompany": { base.Response.ContentType = "application/json"; str2 = "[{\"type\":\"0\",\"data\":[]}]"; IList <ExpressCompanyInfo> allExpress = ExpressHelper.GetAllExpress(); int num2 = 0; StringBuilder builder = new StringBuilder(); foreach (ExpressCompanyInfo info5 in allExpress) { if (num2 == 0) { builder.Append("{\"code\":\"" + String2Json(info5.Kuaidi100Code) + "\",\"name\":\"" + String2Json(info5.Name) + "\"}"); } else { builder.Append(",{\"code\":\"" + String2Json(info5.Kuaidi100Code) + "\",\"name\":\"" + String2Json(info5.Name) + "\"}"); } num2++; } if (!string.IsNullOrEmpty(builder.ToString())) { str2 = "[{\"type\":\"1\",\"data\":[" + builder.ToString() + "]}]"; } base.Response.Write(str2); base.Response.End(); return; } case "updateExpress": { str2 = Globals.RequestFormStr("data"); base.Response.ContentType = "application/json"; str3 = "{\"type\":\"0\",\"tips\":\"修改失败!\"}"; array = (JArray)JsonConvert.DeserializeObject(str2); bool flag4 = true; foreach (JObject obj8 in array) { if (!this.CheckOrderCompany(obj8["orderid"].ToString(), obj8["companycode"].ToString(), obj8["compname"].ToString(), obj8["shipordernumber"].ToString())) { flag4 = false; } } if (flag4) { bool flag5 = false; foreach (JObject obj9 in array) { OrderInfo order = OrderHelper.GetOrderInfo(obj9["orderid"].ToString()); order.ExpressCompanyAbb = obj9["companycode"].ToString(); order.ExpressCompanyName = obj9["compname"].ToString(); order.ShipOrderNumber = obj9["shipordernumber"].ToString(); flag5 = OrderHelper.UpdateOrder(order); if (flag5) { Express.SubscribeExpress100(obj9["companycode"].ToString(), obj9["shipordernumber"].ToString()); } } if (flag5) { str3 = "{\"type\":\"1\",\"tips\":\"修改成功!\"}"; } } else { str3 = "{\"type\":\"0\",\"tips\":\"数据验证失败!\"}"; } base.Response.Write(str3); base.Response.End(); return; } } if (string.IsNullOrEmpty(this.orderIds)) { base.GotoResourceNotFound(); } else { string[] strArray = this.orderIds.Split(new char[] { ',' }); bool flag6 = true; foreach (string str6 in strArray) { if (!Globals.IsOrdersID(str6)) { flag6 = false; break; } } if (flag6) { DataSet ordersByOrderIDList = OrderHelper.GetOrdersByOrderIDList(this.orderIds); this.rptItemList.DataSource = ordersByOrderIDList; this.rptItemList.DataBind(); this.litOrdersCount.Text = ordersByOrderIDList.Tables[0].Rows.Count.ToString(); } else { base.Response.Write("非法参数请求!"); base.Response.End(); } } }
protected void dlstOrders_ItemCommand(object sender, System.Web.UI.WebControls.DataListCommandEventArgs e) { OrderInfo orderInfo = OrderHelper.GetOrderInfo(e.CommandArgument.ToString()); if (orderInfo != null) { if (e.CommandName == "CONFIRM_PAY" && orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY)) { int num = 0; int num2 = 0; int num3 = 0; if (orderInfo.CountDownBuyId > 0) { CountDownInfo countDownBuy = TradeHelper.GetCountDownBuy(orderInfo.CountDownBuyId); if (countDownBuy == null || countDownBuy.EndDate < System.DateTime.Now) { this.ShowMsg("当前的订单为限时抢购订单,此活动已结束,所以不能支付", false); return; } } if (orderInfo.GroupBuyId > 0) { GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(orderInfo.GroupBuyId); if (groupBuy != null) { if (groupBuy.Status == GroupBuyStatus.UnderWay) { num2 = PromoteHelper.GetOrderCount(orderInfo.GroupBuyId); num = groupBuy.MaxCount; num3 = orderInfo.GetGroupBuyOerderNumber(); if (num < num2 + num3) { this.ShowMsg("当前的订单为团购订单,订购数量已超过订购总数,所以不能支付", false); return; } goto IL_E2; } } this.ShowMsg("当前的订单为团购订单,此团购活动已结束,所以不能支付", false); return; } IL_E2: if (OrderHelper.ConfirmPay(orderInfo)) { DebitNote debitNote = new DebitNote(); debitNote.NoteId = Globals.GetGenerateId(); debitNote.OrderId = e.CommandArgument.ToString(); debitNote.Operator = Hidistro.Membership.Context.HiContext.Current.User.Username; debitNote.Remark = "后台" + debitNote.Operator + "收款成功"; OrderHelper.SaveDebitNote(debitNote); if (orderInfo.GroupBuyId > 0 && num == num2 + num3) { PromoteHelper.SetGroupBuyEndUntreated(orderInfo.GroupBuyId); } this.BindOrders(); int num4 = orderInfo.UserId; if (num4 == 1100) { num4 = 0; } Hidistro.Membership.Core.IUser user = Hidistro.Membership.Context.Users.GetUser(num4); Messenger.OrderPayment(user, orderInfo.OrderId, orderInfo.GetTotal()); orderInfo.OnPayment(); this.Page.ClientScript.RegisterClientScriptBlock(base.GetType(), "sucess", string.Format("<script language=\"javascript\" >alert('确认收款成功');window.location.href=\"{0}\"</script>", System.Web.HttpContext.Current.Request.RawUrl)); return; } this.ShowMsg("确认订单收款失败", false); return; } else { if (e.CommandName == "FINISH_TRADE" && orderInfo.CheckAction(OrderActions.SELLER_FINISH_TRADE)) { if (OrderHelper.ConfirmOrderFinish(orderInfo)) { this.BindOrders(); this.ShowMsg("成功的完成了该订单", true); return; } this.ShowMsg("完成订单失败", false); return; } else { if (e.CommandName == "Match_Order") { if (orderInfo == null) { return; } if (orderInfo.GroupBuyId > 0 && orderInfo.GroupBuyStatus != GroupBuyStatus.Success) { this.ShowMsg("当前订单为团购订单,团购活动还未成功结束,所以不能发货", false); return; } if (!orderInfo.CheckAction(OrderActions.SELLER_SEND_GOODS)) { this.ShowMsg("当前订单状态没有付款或不是等待发货的订单,所以不能发货", false); return; } if (Methods.Supplier_OrderIsFenPei(e.CommandArgument.ToString())) { this.ShowMsg("生成成功", true); return; } string text = Methods.Supplier_OrderItemSupplierUpdate(orderInfo); if (text != "true") { this.ShowMsg(text, false); return; } orderInfo.RealShippingModeId = 0; orderInfo.RealModeName = "配送方式(已实际发货单为准)"; orderInfo.ShipOrderNumber = string.Format("{0}", string.Format(" <a style=\"color:red;cursor:pointer;\" target=\"_blank\" onclick=\"{0}\">物流详细</a>", "showWindow_ShipInfoPage('" + orderInfo.OrderId + "')")); if (OrderHelper.SendGoods(orderInfo)) { Methods.Supplier_OrderItemsSupplierFenPeiOverUpdate(orderInfo.OrderId); if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && orderInfo.GatewayOrderId.Trim().Length > 0) { PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.PaymentTypeId); if (paymentMode != null) { PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[] { paymentMode.Gateway })), ""); paymentRequest.SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS"); } } int num5 = orderInfo.UserId; if (num5 == 1100) { num5 = 0; } Hidistro.Membership.Core.IUser user2 = Hidistro.Membership.Context.Users.GetUser(num5); Messenger.OrderShipping(orderInfo, user2); orderInfo.OnDeliver(); this.ShowMsg("生成成功", true); this.BindOrders(); return; } this.ShowMsg("发货失败", false); this.ShowMsg("生成成功", true); } } } } }
public ApiErrorCode SendOrders(OrderInfo order, ShippingModeInfo shippingmode, string out_id, ExpressCompanyInfo express) { if (order.GroupBuyId > 0 && order.GroupBuyStatus != GroupBuyStatus.Success) { return(ApiErrorCode.Group_Error); } if (!order.CheckAction(OrderActions.SELLER_SEND_GOODS)) { return(ApiErrorCode.NoPay_Error); } if (shippingmode.ModeId <= 0) { return(ApiErrorCode.NoShippingMode); } if (string.IsNullOrEmpty(out_id) || out_id.Length > 20) { return(ApiErrorCode.ShipingOrderNumber_Error); } order.RealShippingModeId = shippingmode.ModeId; order.RealModeName = shippingmode.Name; order.ExpressCompanyName = express.Name; order.ExpressCompanyAbb = express.Kuaidi100Code; order.ShipOrderNumber = out_id; if (OrderHelper.SendAPIGoods(order)) { if (!string.IsNullOrEmpty(order.GatewayOrderId)) { PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(order.PaymentTypeId); if (paymentMode != null) { PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), order.OrderId, order.GetTotal(), "订单发货", "订单号-" + order.OrderId, order.EmailAddress, order.OrderDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[] { paymentMode.Gateway })), ""); paymentRequest.SendGoods(order.GatewayOrderId, order.RealModeName, order.ShipOrderNumber, "EXPRESS"); } } if (!string.IsNullOrEmpty(order.TaobaoOrderId)) { try { string requestUriString = string.Format("http://vip.ecdev.cn/UpdateShipping.ashx?tid={0}&companycode={1}&outsid={2}", order.TaobaoOrderId, express.TaobaoCode, order.ShipOrderNumber); System.Net.WebRequest webRequest = System.Net.WebRequest.Create(requestUriString); webRequest.GetResponse(); } catch { } } int num = order.UserId; if (num == 1100) { num = 0; } IUser user = Users.GetUser(num); Messenger.OrderShipping(order, user); order.OnDeliver(); return(ApiErrorCode.Success); } return(ApiErrorCode.Unknown_Error); }
protected void Page_Load(object sender, EventArgs e) { this.btnConfirmPay.Click += new EventHandler(this.btnConfirmPay_Click); this.btnBack.Click += new EventHandler(this.btnBack_Click); this.btnBack1.Click += new EventHandler(this.btnBack_Click); this.imgBtnBack.Click += new ImageClickEventHandler(this.btnBack_Click); if (string.IsNullOrEmpty(base.Request.QueryString["PurchaseOrderId"])) { base.GotoResourceNotFound(); } else { this.purchaseOrderId = base.Request.QueryString["PurchaseOrderId"]; this.purchaseOrder = SubsiteSalesHelper.GetPurchaseOrder(this.purchaseOrderId); if (!base.IsPostBack) { if (this.purchaseOrder == null) { base.GotoResourceNotFound(); } else { int num; int.TryParse(base.Request["PayMode"], out num); PaymentModeInfo paymentMode = SubsiteStoreHelper.GetPaymentMode(num); if ((num > 0) && (paymentMode.Gateway != "hishop.plugins.payment.advancerequest")) { SubsiteStoreHelper.GetDistributor(); string showUrl = Globals.FullPath(Globals.GetSiteUrls().Home); if (paymentMode.Gateway.ToLower() != "hishop.plugins.payment.podrequest") { showUrl = base.Server.UrlEncode(string.Format("http://{0}/shopadmin/purchaseorder/MyPurchaseOrderDetails.aspx?purchaseOrderId={1}", base.Request.Url.Host, this.purchaseOrder.PurchaseOrderId)); } if (string.Compare(paymentMode.Gateway, "Hishop.Plugins.Payment.BankRequest", true) == 0) { showUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("bank_pay", new object[] { this.purchaseOrder.PurchaseOrderId })); } if (string.Compare(paymentMode.Gateway, "Hishop.Plugins.Payment.AdvanceRequest", true) == 0) { showUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("advance_pay", new object[] { this.purchaseOrder.PurchaseOrderId })); } string attach = ""; HttpCookie cookie = HiContext.Current.Context.Request.Cookies["Token_" + HiContext.Current.User.UserId.ToString()]; if ((cookie != null) && !string.IsNullOrEmpty(cookie.Value)) { attach = cookie.Value; } PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), this.purchaseOrder.PurchaseOrderId, this.purchaseOrder.GetPurchaseTotal(), "采购单支付", "采购单号-" + this.purchaseOrder.PurchaseOrderId, "", this.purchaseOrder.PurchaseDate, showUrl, Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("DistributorPaymentNotify_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("DistributorPaymentNotify_url", new object[] { paymentMode.Gateway })), attach).SendRequest(); } if (this.purchaseOrder.IsManualPurchaseOrder) { this.litorder.Visible = false; this.litOrderId.Visible = false; } else { this.litOrderId.Text = this.purchaseOrder.OrderId; } this.litPurchaseOrderId.Text = this.purchaseOrder.PurchaseOrderId; this.lblPurchaseDate.Time = this.purchaseOrder.PurchaseDate; this.lblTotalPrice.Money = this.purchaseOrder.GetPurchaseTotal(); AccountSummaryInfo myAccountSummary = SubsiteStoreHelper.GetMyAccountSummary(); this.lblUseableBalance.Money = myAccountSummary.UseableBalance; } } } }
private void btnSendGoods_Click(object sender, System.EventArgs e) { OrderInfo orderInfo = OrderHelper.GetOrderInfo(this.orderId); if (orderInfo == null) { return; } if (orderInfo.GroupBuyId > 0 && orderInfo.GroupBuyStatus != GroupBuyStatus.Success) { this.ShowMsg("当前订单为团购订单,团购活动还未成功结束,所以不能发货", false); return; } if (!orderInfo.CheckAction(OrderActions.SELLER_SEND_GOODS)) { this.ShowMsg("当前订单状态没有付款或不是等待发货的订单,所以不能发货", false); return; } if (Methods.Supplier_OrderIsFenPei(this.orderId)) { this.ShowMsg("生成成功", true); return; } string text = Methods.Supplier_OrderItemSupplierUpdate(orderInfo); if (text != "true") { this.ShowMsg(text, false); return; } orderInfo.RealShippingModeId = 0; orderInfo.RealModeName = "配送方式(已实际发货单为准)"; orderInfo.ShipOrderNumber = string.Format("{0}", string.Format(" <a style=\"color:red;cursor:pointer;\" target=\"_blank\" onclick=\"{0}\">物流详细</a>", "showWindow_ShipInfoPage('" + orderInfo.OrderId + "')")); if (OrderHelper.SendGoods(orderInfo)) { Methods.Supplier_OrderItemsSupplierFenPeiOverUpdate(orderInfo.OrderId); if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && orderInfo.GatewayOrderId.Trim().Length > 0) { PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.PaymentTypeId); if (paymentMode != null) { PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[] { paymentMode.Gateway })), ""); paymentRequest.SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, "物流单(已实际发货单为准,可在下单网站查看)", "EXPRESS"); } } int num = orderInfo.UserId; if (num == 1100) { num = 0; } Hidistro.Membership.Core.IUser user = Hidistro.Membership.Context.Users.GetUser(num); Messenger.OrderShipping(orderInfo, user); orderInfo.OnDeliver(); this.CloseWindow(); return; } this.ShowMsg("发货失败", false); }
//订单完成 protected override void AttachChildControls() { this.orderId = this.Page.Request.QueryString["orderId"]; List <OrderInfo> orderMarkingOrderInfo = ShoppingProcessor.GetOrderMarkingOrderInfo(this.orderId); decimal amount = 0M; if (orderMarkingOrderInfo.Count == 0) { this.Page.Response.Redirect("/Vshop/MemberOrders.aspx?status=0"); } bool flag = true; foreach (OrderInfo info in orderMarkingOrderInfo) { amount += info.GetTotal(); foreach (LineItemInfo info2 in info.LineItems.Values) { if (info2.Type == 0) { flag = false; } foreach (LineItemInfo info3 in info.LineItems.Values) { if (!ProductHelper.GetProductHasSku(info3.SkuId, info3.Quantity)) { info.OrderStatus = OrderStatus.Closed; info.CloseReason = "库存不足"; OrderHelper.UpdateOrder(info); HttpContext.Current.Response.Write("<script>alert('库存不足,订单自动关闭!');location.href='/Vshop/MemberOrders.aspx'</script>"); HttpContext.Current.Response.End(); return; } } } } if (!(string.IsNullOrEmpty(orderMarkingOrderInfo[0].Gateway) || !(orderMarkingOrderInfo[0].Gateway == "hishop.plugins.payment.offlinerequest"))) { this.litMessage = (Literal)this.FindControl("litMessage"); this.litMessage.SetWhenIsNotNull(SettingsManager.GetMasterSettings(false).OffLinePayContent); } this.btnToPay = (HtmlAnchor)this.FindControl("btnToPay"); if (!(string.IsNullOrEmpty(orderMarkingOrderInfo[0].Gateway) || !(orderMarkingOrderInfo[0].Gateway == "hishop.plugins.payment.weixinrequest"))) { this.btnToPay.Visible = true; this.btnToPay.HRef = "~/pay/wx_Submit.aspx?orderId=" + this.orderId; } if (((!string.IsNullOrEmpty(orderMarkingOrderInfo[0].Gateway) && (orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.podrequest")) && (orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.offlinerequest")) && (orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.weixinrequest")) { PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(orderMarkingOrderInfo[0].PaymentTypeId); string attach = ""; string showUrl = string.Format("http://{0}/vshop/", HttpContext.Current.Request.Url.Host); #region 积分处理 int UserId = Globals.GetCurrentMemberUserId(); string sql = "select PointsForMoney from [dbo].[PointsForMoney] where [UserId]=@UserId"; SqlParameter[] param = new SqlParameter[] { new SqlParameter("@UserId", UserId) }; int PointsFor = help.ExecuteScalar(sql, CommandType.Text, param); if (PointsFor != 0) { amount -= PointsFor; } #endregion // System.IO.File.WriteAllText("e:\\测试.txt", "时间:" + DateTime.Now.ToString() + " PointsFor:" + PointsFor + " amount:" + amount); //调用支付宝支付方法 PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), this.orderId, amount, "订单支付", "订单号-" + this.orderId, orderMarkingOrderInfo[0].EmailAddress, orderMarkingOrderInfo[0].OrderDate, showUrl, Globals.FullPath("/pay/PaymentReturn_url.aspx"), Globals.FullPath("/pay/PaymentNotify_url.aspx"), attach).SendRequest(); } else { this.litOrderId = (Literal)this.FindControl("litOrderId"); this.litOrderTotal = (Literal)this.FindControl("litOrderTotal"); this.literalOrderTotal = (Literal)this.FindControl("literalOrderTotal"); this.litPaymentType = (HtmlInputHidden)this.FindControl("litPaymentType"); int result = 0; this.litPaymentType.SetWhenIsNotNull("0"); if (int.TryParse(this.Page.Request.QueryString["PaymentType"], out result)) { this.litPaymentType.SetWhenIsNotNull(result.ToString()); } this.litOrderId.SetWhenIsNotNull(this.orderId); if (flag) { this.litOrderTotal.SetWhenIsNotNull("您需要支付:\x00a5" + amount.ToString("F2")); } this.literalOrderTotal.SetWhenIsNotNull("订单金额:<span style='color:red'>\x00a5" + amount.ToString("F2") + "</span>"); this.litHelperText = (Literal)this.FindControl("litHelperText"); SiteSettings masterSettings = SettingsManager.GetMasterSettings(false); this.litHelperText.SetWhenIsNotNull(masterSettings.OffLinePayContent); PageTitle.AddSiteNameTitle("下单成功"); } }
private void btnSendGoods_Click(object sender, System.EventArgs e) { if (this.txtShipOrderNumber.Text.IndexOf("showWindow_ShipInfoPage") != -1) { OrderInfo orderInfo = SubsiteSalesHelper.GetOrderInfo(this.orderId); if (orderInfo == null) { return; } if (orderInfo.GroupBuyId > 0 && orderInfo.GroupBuyStatus != GroupBuyStatus.Success) { this.ShowMsg("当前订单为团购订单,团购活动还未成功结束,所以不能发货", false); return; } if (orderInfo.OrderStatus != OrderStatus.BuyerAlreadyPaid) { this.ShowMsg("当前订单状态没有付款或不是等待发货的订单,所以不能发货", false); return; } orderInfo.RealShippingModeId = 0; orderInfo.RealModeName = "配送方式(已实际发货单为准)"; orderInfo.ShipOrderNumber = this.txtShipOrderNumber.Text; if (SubsiteSalesHelper.SendGoods(orderInfo)) { if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && orderInfo.GatewayOrderId.Trim().Length > 0) { PaymentModeInfo paymentMode = SubsiteSalesHelper.GetPaymentMode(orderInfo.PaymentTypeId); if (paymentMode != null) { PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[] { paymentMode.Gateway })), ""); paymentRequest.SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS"); } } int num = orderInfo.UserId; if (num == 1100) { num = 0; } Hidistro.Membership.Core.IUser user = Hidistro.Membership.Context.Users.GetUser(num); Messenger.OrderShipping(orderInfo, user); orderInfo.OnDeliver(); this.ShowMsg("发货成功", true); return; } this.ShowMsg("发货失败", false); return; } else { if (string.IsNullOrEmpty(this.txtShipOrderNumber.Text.Trim()) || this.txtShipOrderNumber.Text.Trim().Length > 20) { this.ShowMsg("运单号码不能为空,在1至20个字符之间", false); return; } OrderInfo orderInfo2 = SubsiteSalesHelper.GetOrderInfo(this.orderId); if (orderInfo2 == null) { return; } if (orderInfo2.GroupBuyId > 0 && orderInfo2.GroupBuyStatus != GroupBuyStatus.Success) { this.ShowMsg("当前订单为团购订单,团购活动还未成功结束,所以不能发货", false); return; } if (orderInfo2.OrderStatus != OrderStatus.BuyerAlreadyPaid) { this.ShowMsg("当前订单状态没有付款或不是等待发货的订单,所以不能发货", false); return; } if (!this.radioShippingMode.SelectedValue.HasValue) { this.ShowMsg("请选择配送方式", false); return; } if (string.IsNullOrEmpty(this.expressRadioButtonList.SelectedValue)) { this.ShowMsg("请选择物流公司", false); return; } ShippingModeInfo shippingMode = SubsiteSalesHelper.GetShippingMode(this.radioShippingMode.SelectedValue.Value, true); orderInfo2.RealShippingModeId = this.radioShippingMode.SelectedValue.Value; orderInfo2.RealModeName = shippingMode.Name; ExpressCompanyInfo expressCompanyInfo = ExpressHelper.FindNode(this.expressRadioButtonList.SelectedValue); if (expressCompanyInfo != null) { orderInfo2.ExpressCompanyAbb = expressCompanyInfo.Kuaidi100Code; orderInfo2.ExpressCompanyName = expressCompanyInfo.Name; } orderInfo2.ShipOrderNumber = this.txtShipOrderNumber.Text; if (SubsiteSalesHelper.SendGoods(orderInfo2)) { if (!string.IsNullOrEmpty(orderInfo2.GatewayOrderId) && orderInfo2.GatewayOrderId.Trim().Length > 0) { PaymentModeInfo paymentMode2 = SubsiteSalesHelper.GetPaymentMode(orderInfo2.PaymentTypeId); if (paymentMode2 != null) { PaymentRequest paymentRequest2 = PaymentRequest.CreateInstance(paymentMode2.Gateway, HiCryptographer.Decrypt(paymentMode2.Settings), orderInfo2.OrderId, orderInfo2.GetTotal(), "订单发货", "订单号-" + orderInfo2.OrderId, orderInfo2.EmailAddress, orderInfo2.OrderDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[] { paymentMode2.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[] { paymentMode2.Gateway })), ""); paymentRequest2.SendGoods(orderInfo2.GatewayOrderId, orderInfo2.RealModeName, orderInfo2.ShipOrderNumber, "EXPRESS"); } } int num2 = orderInfo2.UserId; if (num2 == 1100) { num2 = 0; } Hidistro.Membership.Core.IUser user2 = Hidistro.Membership.Context.Users.GetUser(num2); Messenger.OrderShipping(orderInfo2, user2); orderInfo2.OnDeliver(); this.ShowMsg("发货成功", true); return; } this.ShowMsg("发货失败", false); return; } }
private ConfigData LoadConfig(out string selectedName) { selectedName = base.Request.Form["ddlPayments"]; this.txtSelectedName.Value = selectedName; this.txtConfigData.Value = ""; if (selectedName.Equals("hishop.plugins.payment.bankuniongateway.bankuniongetwayrequest") && this.fileBankUnionCert.HasFile) { if (!Globals.ValidateCertFile(this.fileBankUnionCert.PostedFile.FileName)) { this.ShowMsg("非法的证书文件", false); return(null); } this.fileBankUnionCert.PostedFile.SaveAs(base.Server.MapPath("~/config/") + this.fileBankUnionCert.PostedFile.FileName); } string text = ""; if (selectedName.StartsWith("hishop.plugins.payment.")) { text = selectedName.Replace("hishop.plugins.payment.", ""); } if (text.LastIndexOf(".") > 0) { text = text.Substring(0, text.LastIndexOf(".")); } if (!string.IsNullOrEmpty(text)) { text += "/"; } HttpFileCollection files = base.Request.Files; NameValueCollection nameValueCollection = new NameValueCollection(); ConfigablePlugin configablePlugin = PaymentRequest.CreateInstance(selectedName); if (configablePlugin == null) { return(null); } if (string.IsNullOrEmpty(selectedName) || selectedName.Length == 0) { return(null); } string[] allKeys = base.Request.Form.AllKeys; foreach (string text2 in allKeys) { if (text2 == "SignCertFileName") { nameValueCollection.Add(text2, this.fileBankUnionCert.PostedFile.FileName); } else { nameValueCollection.Add(text2, base.Request.Form[text2].Trim()); } } IList <string> fileConfigNames = configablePlugin.GetFileConfigNames(); if (fileConfigNames != null && files.Count >= 2 && files.Count > fileConfigNames.Count) { string text3 = "/pay/cert/" + text; if (!Globals.PathExist(text3, false)) { Globals.CreatePath(text3); } for (int j = 1; j < files.Count; j++) { if (files[j].ContentLength > 0) { if (Globals.ValidateCertFile(files[j].FileName)) { files[j].SaveAs(base.Server.MapPath(text3 + files[j].FileName)); nameValueCollection.Add(fileConfigNames[j - 1], text3 + files[j].FileName); continue; } this.ShowMsg("非法的证书文件", false); return(null); } nameValueCollection.Add(fileConfigNames[j - 1], ""); } } ConfigData configData = configablePlugin.GetConfigData(nameValueCollection); if (configData != null) { this.txtConfigData.Value = configData.SettingsXml; } return(configData); }
protected void Page_Load(object sender, EventArgs e) { string orderId = this.Page.Request.QueryString["orderId"]; OrderInfo orderInfo = Hidistro.SaleSystem.Vshop.TradeHelper.GetOrderInfo(orderId); if (orderInfo == null) { base.Response.Write("<div><font color='red'>您要付款的订单已经不存在,请联系管理员确定</font></div>"); } else if (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay) { this.Page.Response.Write("订单当前状态不能支付"); } else { if (orderInfo.CountDownBuyId > 0) { CountDownInfo countDownInfoByCountDownId = ProductBrowser.GetCountDownInfoByCountDownId(orderInfo.CountDownBuyId); if ((countDownInfoByCountDownId == null) || (countDownInfoByCountDownId.EndDate < DateTime.Now)) { this.Page.Response.Write("此订单属于限时抢购类型订单,但限时抢购活动已经结束或不存在"); return; } } PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(orderInfo.PaymentTypeId); //PaymentModeInfo paymentMode = Hidistro.SaleSystem.Vshop.TradeHelper.GetPaymentMode(orderInfo.PaymentTypeId); if (paymentMode == null) { base.Response.Write("<div><font color='red'>您之前选择的支付方式已经不存在,请联系管理员修改支付方式</font></div>"); } else { /* * foreach (LineItemInfo info4 in orderInfo.LineItems.Values) * { * int productId = info4.ProductId; * SiteSettings masterSettings = SettingsManager.GetMasterSettings(true); * ProductBrowseInfo info5 = ProductBrowser.GetProductBrowseInfo(productId, 6, 6, 0,false); * //ProductBrowseInfo info5 = ProductBrowser.GetProducts * if ((info5.Product == null) || (info5.Product.SaleStatus == ProductSaleStatus.Delete)) * { * base.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("订单内商品已经被管理员删除")); * return; * } * if (info5.Product.SaleStatus == ProductSaleStatus.OnStock) * { * base.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("订单内商品已入库")); * return; * } * int stock = info5.Product.Stock; * if (info4.ShipmentQuantity > stock) * { * base.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("订单内商品库存不足")); * return; * } * } */ string showUrl = Globals.GetSiteUrls().UrlData.FormatUrl("user_UserOrders"); if (paymentMode.Gateway.ToLower() != "hishop.plugins.payment.podrequest") { showUrl = base.Server.UrlEncode(string.Format("http://{0}/user/OrderDetails.aspx?OrderId={1}", base.Request.Url.Host, orderInfo.OrderId)); } if (string.Compare(paymentMode.Gateway, "Hishop.Plugins.Payment.BankRequest", true) == 0) { showUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("bank_pay", new object[] { orderInfo.OrderId })); } if (string.Compare(paymentMode.Gateway, "Hishop.Plugins.Payment.AdvanceRequest", true) == 0) { showUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("advance_pay", new object[] { orderInfo.OrderId })); } string attach = ""; //HttpCookie cookie = HiContext.Current.Context.Request.Cookies["Token_" + HiContext.Current.User.UserId.ToString()]; //if ((cookie != null) && !string.IsNullOrEmpty(cookie.Value)) //{ // attach = cookie.Value; //} PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单支付", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, showUrl, Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[] { paymentMode.Gateway })), attach).SendRequest(); } } }
private void btnSendGoods_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtShipOrderNumber.Text.Trim()) || (txtShipOrderNumber.Text.Trim().Length > 20)) { ShowMsg("运单号码不能为空,在1至20个字符之间", false); } else { OrderInfo orderInfo = SubsiteSalesHelper.GetOrderInfo(orderId); if (orderInfo != null) { if ((orderInfo.GroupBuyId > 0) && (orderInfo.GroupBuyStatus != GroupBuyStatus.Success)) { ShowMsg("当前订单为团购订单,团购活动还未成功结束,所以不能发货", false); } else if (orderInfo.OrderStatus != OrderStatus.BuyerAlreadyPaid) { ShowMsg("当前订单状态没有付款或不是等待发货的订单,所以不能发货", false); } else if (!radioShippingMode.SelectedValue.HasValue) { ShowMsg("请选择配送方式", false); } else if (string.IsNullOrEmpty(expressRadioButtonList.SelectedValue)) { ShowMsg("请选择物流公司", false); } else { ShippingModeInfo shippingMode = SubsiteSalesHelper.GetShippingMode(radioShippingMode.SelectedValue.Value, true); orderInfo.RealShippingModeId = radioShippingMode.SelectedValue.Value; orderInfo.RealModeName = shippingMode.Name; orderInfo.ExpressCompanyAbb = expressRadioButtonList.SelectedValue; orderInfo.ExpressCompanyName = expressRadioButtonList.SelectedItem.Text; orderInfo.ShipOrderNumber = txtShipOrderNumber.Text; if (SubsiteSalesHelper.SendGoods(orderInfo)) { if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && (orderInfo.GatewayOrderId.Trim().Length > 0)) { PaymentModeInfo paymentMode = SubsiteSalesHelper.GetPaymentMode(orderInfo.PaymentTypeId); if (paymentMode != null) { PaymentRequest.CreateInstance(paymentMode.Gateway, Cryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[] { paymentMode.Gateway })), "").SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS"); } } int userId = orderInfo.UserId; if (userId == 0x44c) { userId = 0; } IUser user = Users.GetUser(userId); Messenger.OrderShipping(orderInfo, user); orderInfo.OnDeliver(); ShowMsg("发货成功", true); } else { ShowMsg("发货失败", false); } } } } }
private void btnSendGoods_Click(object sender, EventArgs e) { OrderInfo orderInfo = OrderHelper.GetOrderInfo(this.orderId); if (orderInfo != null) { ManagerInfo currentManager = ManagerHelper.GetCurrentManager(); if (currentManager != null) { if ((orderInfo.GroupBuyId > 0) && (orderInfo.GroupBuyStatus != GroupBuyStatus.Success)) { this.ShowMsg("当前订单为团购订单,团购活动还未成功结束,所以不能发货", false); } else if (!orderInfo.CheckAction(OrderActions.SELLER_SEND_GOODS)) { this.ShowMsg("当前订单状态没有付款或不是等待发货的订单,所以不能发货", false); } else if (!this.radioShippingMode.SelectedValue.HasValue) { this.ShowMsg("请选择配送方式", false); } else if (string.IsNullOrEmpty(this.txtShipOrderNumber.Text.Trim()) || (this.txtShipOrderNumber.Text.Trim().Length > 20)) { this.ShowMsg("运单号码不能为空,在1至20个字符之间", false); } else if (string.IsNullOrEmpty(this.expressRadioButtonList.SelectedValue)) { this.ShowMsg("请选择物流公司", false); } else { ShippingModeInfo shippingMode = SalesHelper.GetShippingMode(this.radioShippingMode.SelectedValue.Value, true); orderInfo.RealShippingModeId = this.radioShippingMode.SelectedValue.Value; orderInfo.RealModeName = shippingMode.Name; ExpressCompanyInfo info4 = ExpressHelper.FindNode(this.expressRadioButtonList.SelectedValue); if (info4 != null) { orderInfo.ExpressCompanyAbb = info4.Kuaidi100Code; orderInfo.ExpressCompanyName = info4.Name; } orderInfo.ShipOrderNumber = this.txtShipOrderNumber.Text; if (OrderHelper.SendGoods(orderInfo)) { SendNoteInfo info5 = new SendNoteInfo(); info5.NoteId = Globals.GetGenerateId(); info5.OrderId = this.orderId; info5.Operator = currentManager.UserName; info5.Remark = "后台" + info5.Operator + "发货成功"; OrderHelper.SaveSendNote(info5); MemberInfo member = MemberHelper.GetMember(orderInfo.UserId); Messenger.OrderShipping(orderInfo, member); if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && (orderInfo.GatewayOrderId.Trim().Length > 0)) { if (orderInfo.Gateway == "hishop.plugins.payment.ws_wappay.wswappayrequest") { PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.PaymentTypeId); if (paymentMode != null) { PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[] { paymentMode.Gateway })), "").SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS"); } } if (orderInfo.Gateway == "hishop.plugins.payment.weixinrequest") { SiteSettings masterSettings = SettingsManager.GetMasterSettings(false); PayClient client = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, masterSettings.WeixinPaySignKey); DeliverInfo deliver = new DeliverInfo { TransId = orderInfo.GatewayOrderId, OutTradeNo = orderInfo.OrderId, OpenId = MemberHelper.GetMember(orderInfo.UserId).OpenId }; client.DeliverNotify(deliver); } } orderInfo.OnDeliver(); this.ShowMsg("发货成功", true); } else { this.ShowMsg("发货失败", false); } } } } }
protected override void AttachChildControls() { this.orderId = this.Page.Request.QueryString["orderId"]; System.Collections.Generic.List <OrderInfo> orderMarkingOrderInfo = ShoppingProcessor.GetOrderMarkingOrderInfo(this.orderId); decimal num = 0m; if (orderMarkingOrderInfo.Count == 0) { this.Page.Response.Redirect("/Vshop/MemberOrders.aspx?status=0"); } bool flag = true; foreach (OrderInfo current in orderMarkingOrderInfo) { num += current.GetTotal(); foreach (LineItemInfo current2 in current.LineItems.Values) { if (current2.Type == 0) { flag = false; } foreach (LineItemInfo current3 in current.LineItems.Values) { if (!ProductHelper.GetProductHasSku(current3.SkuId, current3.Quantity)) { current.OrderStatus = OrderStatus.Closed; current.CloseReason = "库存不足"; OrderHelper.UpdateOrder(current); System.Web.HttpContext.Current.Response.Write("<script>alert('库存不足,订单自动关闭!');location.href='/Vshop/MemberOrders.aspx'</script>"); System.Web.HttpContext.Current.Response.End(); return; } } } } if (!string.IsNullOrEmpty(orderMarkingOrderInfo[0].Gateway) && orderMarkingOrderInfo[0].Gateway == "hishop.plugins.payment.offlinerequest") { this.litMessage = (System.Web.UI.WebControls.Literal) this.FindControl("litMessage"); this.litMessage.SetWhenIsNotNull(SettingsManager.GetMasterSettings(false).OffLinePayContent); } this.btnToPay = (System.Web.UI.HtmlControls.HtmlAnchor) this.FindControl("btnToPay"); if (!string.IsNullOrEmpty(orderMarkingOrderInfo[0].Gateway) && orderMarkingOrderInfo[0].Gateway == "hishop.plugins.payment.weixinrequest") { this.btnToPay.Visible = true; this.btnToPay.HRef = "~/pay/wx_Submit.aspx?orderId=" + this.orderId; } if (!string.IsNullOrEmpty(orderMarkingOrderInfo[0].Gateway) && orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.podrequest" && orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.offlinerequest" && orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.weixinrequest") { PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(orderMarkingOrderInfo[0].PaymentTypeId); string attach = ""; string showUrl = string.Format("http://{0}/vshop/", System.Web.HttpContext.Current.Request.Url.Host); PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), this.orderId, num, "订单支付", "订单号-" + this.orderId, orderMarkingOrderInfo[0].EmailAddress, orderMarkingOrderInfo[0].OrderDate, showUrl, Globals.FullPath("/pay/PaymentReturn_url.aspx"), Globals.FullPath("/pay/PaymentNotify_url.aspx"), attach); paymentRequest.SendRequest(); } else { this.litOrderId = (System.Web.UI.WebControls.Literal) this.FindControl("litOrderId"); this.litOrderTotal = (System.Web.UI.WebControls.Literal) this.FindControl("litOrderTotal"); this.literalOrderTotal = (System.Web.UI.WebControls.Literal) this.FindControl("literalOrderTotal"); this.litPaymentType = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("litPaymentType"); int num2 = 0; this.litPaymentType.SetWhenIsNotNull("0"); if (int.TryParse(this.Page.Request.QueryString["PaymentType"], out num2)) { this.litPaymentType.SetWhenIsNotNull(num2.ToString()); } this.litOrderId.SetWhenIsNotNull(this.orderId); if (flag) { this.litOrderTotal.SetWhenIsNotNull("您需要支付:¥" + num.ToString("F2")); } this.literalOrderTotal.SetWhenIsNotNull("订单金额:<span style='color:red'>¥" + num.ToString("F2") + "</span>"); this.litHelperText = (System.Web.UI.WebControls.Literal) this.FindControl("litHelperText"); SiteSettings masterSettings = SettingsManager.GetMasterSettings(false); this.litHelperText.SetWhenIsNotNull(masterSettings.OffLinePayContent); PageTitle.AddSiteNameTitle("下单成功"); } }
private void btnSendGoods_Click(object sender, EventArgs e) { int num = this.txtSendGoodType.Value.ToInt(0); if (this.grdOrderGoods.Items.Count <= 0) { this.ShowMsg("没有要进行发货的订单。", false); } else { int num2 = 0; for (int i = 0; i < this.grdOrderGoods.Items.Count; i++) { HiddenField hiddenField = (HiddenField)this.grdOrderGoods.Items[i].FindControl("txtDeliveryNo"); string text = hiddenField.Value.ToNullString(); if (num != 2 || !(text == "")) { HiddenField hiddenField2 = (HiddenField)this.grdOrderGoods.Items[i].FindControl("hidorderId"); string value = hiddenField2.Value; TextBox textBox = (TextBox)this.grdOrderGoods.Items[i].FindControl("txtShippOrderNumber"); ExpressDropDownList expressDropDownList = this.grdOrderGoods.Items[i].FindControl("expressList1") as ExpressDropDownList; OrderInfo orderInfo = OrderHelper.GetOrderInfo(value); if ((orderInfo.GroupBuyId <= 0 || orderInfo.GroupBuyStatus == GroupBuyStatus.Success) && ((orderInfo.OrderStatus == OrderStatus.WaitBuyerPay && orderInfo.Gateway == "hishop.plugins.payment.podrequest") || orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid)) { ExpressCompanyInfo expressCompanyInfo = null; switch (num) { case 1: if (!string.IsNullOrEmpty(expressDropDownList.SelectedValue)) { expressCompanyInfo = ExpressHelper.FindNode(expressDropDownList.SelectedValue); } if (expressCompanyInfo != null) { orderInfo.ExpressCompanyName = expressCompanyInfo.Name; orderInfo.ExpressCompanyAbb = expressCompanyInfo.Kuaidi100Code; orderInfo.ShipOrderNumber = textBox.Text; } break; case 2: orderInfo.ExpressCompanyName = "同城物流配送"; orderInfo.ExpressCompanyAbb = ""; orderInfo.ShipOrderNumber = ""; orderInfo.DadaStatus = DadaStatus.WaitOrder; break; default: orderInfo.ExpressCompanyName = ""; orderInfo.ExpressCompanyAbb = ""; orderInfo.ShipOrderNumber = ""; break; } OrderStatus orderStatus = orderInfo.OrderStatus; if (OrderHelper.SendGoods(orderInfo)) { if (expressCompanyInfo != null && !string.IsNullOrEmpty(orderInfo.ExpressCompanyAbb) && orderInfo.ExpressCompanyAbb.ToUpper() == "HTKY") { ExpressHelper.GetDataByKuaidi100(orderInfo.ExpressCompanyAbb, orderInfo.ShipOrderNumber); } if (orderStatus == OrderStatus.WaitBuyerPay) { OrderHelper.ChangeStoreStockAndWriteLog(orderInfo); } if (orderInfo.Gateway.ToLower() == "hishop.plugins.payment.podrequest") { OrderHelper.SetOrderIsStoreCollect(orderInfo.OrderId); ProductStatisticsHelper.UpdateOrderSaleStatistics(orderInfo); TransactionAnalysisHelper.AnalysisOrderTranData(orderInfo); } if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && orderInfo.GatewayOrderId.Trim().Length > 0) { PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.Gateway); if (paymentMode != null) { string hIGW = paymentMode.Gateway.Replace(".", "_"); PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.TryDecypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(false), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(""), Globals.FullPath(base.GetRouteUrl("PaymentReturn_url", new { HIGW = hIGW })), Globals.FullPath(base.GetRouteUrl("PaymentNotify_url", new { HIGW = hIGW })), ""); paymentRequest.SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS"); } } if (orderInfo.ExpressCompanyName == "同城物流配送" && !string.IsNullOrEmpty(text)) { SiteSettings masterSettings = SettingsManager.GetMasterSettings(); DadaHelper.addAfterQuery(masterSettings.DadaSourceID, text); } if (!string.IsNullOrEmpty(orderInfo.OuterOrderId) && expressCompanyInfo != null) { if (orderInfo.OuterOrderId.StartsWith("tb_")) { string text2 = orderInfo.OuterOrderId.Replace("tb_", ""); try { string requestUriString = $"http://order2.kuaidiangtong.com/UpdateShipping.ashx?tid={text2}&companycode={expressCompanyInfo.TaobaoCode}&outsid={orderInfo.ShipOrderNumber}&Host={HiContext.Current.SiteUrl}"; WebRequest webRequest = WebRequest.Create(requestUriString); webRequest.GetResponse(); } catch { } } else if (orderInfo.OuterOrderId.StartsWith("jd_")) { string text2 = orderInfo.OuterOrderId.Replace("jd_", ""); } } MemberInfo user = Users.GetUser(orderInfo.UserId); Messenger.OrderShipping(orderInfo, user); orderInfo.OnDeliver(); num2++; } } } } if (num2 == 0) { this.ShowMsg("批量发货失败,商品库存不足或者有商品正在退货,换货中的订单不能发货!", false); } else if (num2 > 0) { this.BindData(); this.ShowMsg($"批量发货成功!发货数量{num2}个,商品库存不足或者有商品正在退货,换货中的订单不能发货!", true); } } }
private void btnSendGoods_Click(object sender, EventArgs e) { if (grdOrderGoods.Rows.Count <= 0) { ShowMsg("没有要进行发货的订单。", false); } else { DropdownColumn column = (DropdownColumn)grdOrderGoods.Columns[4]; ListItemCollection selectedItems = column.SelectedItems; DropdownColumn column2 = (DropdownColumn)grdOrderGoods.Columns[5]; ListItemCollection items2 = column2.SelectedItems; int num = 0; for (int i = 0; i < selectedItems.Count; i++) { string orderId = (string)grdOrderGoods.DataKeys[grdOrderGoods.Rows[i].RowIndex].Value; TextBox box = (TextBox)grdOrderGoods.Rows[i].FindControl("txtShippOrderNumber"); ListItem item = selectedItems[i]; ListItem item2 = items2[i]; int result = 0; int.TryParse(item.Value, out result); if ((!string.IsNullOrEmpty(box.Text.Trim()) && !string.IsNullOrEmpty(item.Value)) && ((int.Parse(item.Value) > 0) && !string.IsNullOrEmpty(item2.Value))) { OrderInfo orderInfo = OrderHelper.GetOrderInfo(orderId); if (((orderInfo.GroupBuyId <= 0) || (orderInfo.GroupBuyStatus == GroupBuyStatus.Success)) && (((orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid) && (result > 0)) && (!string.IsNullOrEmpty(box.Text.Trim()) && (box.Text.Trim().Length <= 20)))) { ShippingModeInfo shippingMode = SalesHelper.GetShippingMode(result, true); orderInfo.RealShippingModeId = shippingMode.ModeId; orderInfo.RealModeName = shippingMode.Name; orderInfo.ExpressCompanyAbb = item2.Value; orderInfo.ExpressCompanyName = item2.Text; orderInfo.ShipOrderNumber = box.Text; if (OrderHelper.SendGoods(orderInfo)) { if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && (orderInfo.GatewayOrderId.Trim().Length > 0)) { PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.PaymentTypeId); if (paymentMode != null) { PaymentRequest.CreateInstance(paymentMode.Gateway, Cryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[] { paymentMode.Gateway })), "").SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS"); } } int userId = orderInfo.UserId; if (userId == 0x44c) { userId = 0; } IUser user = Users.GetUser(userId); Messenger.OrderShipping(orderInfo, user); orderInfo.OnDeliver(); num++; } } } } if (num == 0) { ShowMsg("批量发货失败!", false); } else if (num > 0) { BindData(); ShowMsg(string.Format("批量发货成功!发货数量{0}个", num), true); } } }
private string sendGoods(HttpContext context) { string text = context.Request["OrderNO"].Trim(); string text2 = context.Request["SndStyle"].Trim(); string text3 = context.Request["BillID"].Trim(); IDictionary <string, string> dictionary = new Dictionary <string, string>(); dictionary.Add("OrderId", text); dictionary.Add("SndStyle", text2); dictionary.Add("BillID", text3); dictionary.Add("ErrorMsg", ""); if (text.IndexOf(',') > 0) { return("<?xml version='1.0' encoding='utf-8'?><Rsp><Result>0</Result><Cause><![CDATA[{不支持合并发货,请选择单个订单}]]></Cause></Rsp>"); } OrderInfo orderInfo = OrderHelper.GetOrderInfo(text); if (orderInfo == null) { return("<?xml version='1.0' encoding='utf-8'?><Rsp><Result>0</Result><Cause><![CDATA[{未找到此订单}]]></Cause></Rsp>"); } if (orderInfo.OrderStatus == OrderStatus.WaitBuyerPay && OrderHelper.NeedUpdateStockWhenSendGoods(orderInfo) && !OrderHelper.CheckStock(orderInfo)) { return("<?xml version='1.0' encoding='utf-8'?><Rsp><Result>0</Result><Cause><![CDATA[{订单有商品库存不足,请补充库存后发货!}]]></Cause></Rsp>"); } if (orderInfo.GroupBuyId > 0 && orderInfo.GroupBuyStatus != GroupBuyStatus.Success) { return("<?xml version='1.0' encoding='utf-8'?><Rsp><Result>0</Result><Cause><![CDATA[{当前订单为团购订单,团购活动还未成功结束,所以不能发货!}]]></Cause></Rsp>"); } if (!orderInfo.CheckAction(OrderActions.SELLER_SEND_GOODS)) { return("<?xml version='1.0' encoding='utf-8'?><Rsp><Result>0</Result><Cause><![CDATA[{当前订单状态没有付款或不是等待发货的订单,所以不能发货!}]]></Cause></Rsp>"); } if (string.IsNullOrEmpty(text3.Trim()) || text3.Trim().Length > 20) { return("<?xml version='1.0' encoding='utf-8'?><Rsp><Result>0</Result><Cause><![CDATA[{运单号码不能为空,在1至20个字符之间!}]]></Cause></Rsp>"); } ExpressCompanyInfo expressCompanyInfo = ExpressHelper.FindNodeLikeName(text2); if (expressCompanyInfo != null) { orderInfo.ExpressCompanyAbb = expressCompanyInfo.Kuaidi100Code; orderInfo.ExpressCompanyName = expressCompanyInfo.Name; } else { orderInfo.ExpressCompanyAbb = ""; orderInfo.ExpressCompanyName = text2; } orderInfo.ShipOrderNumber = text3; if (!string.IsNullOrEmpty(orderInfo.OuterOrderId) && orderInfo.OuterOrderId.StartsWith("jd_") && (expressCompanyInfo == null || string.IsNullOrWhiteSpace(expressCompanyInfo.JDCode))) { return("<?xml version='1.0' encoding='utf-8'?><Rsp><Result>0</Result><Cause><![CDATA[{此订单是京东订单,所选物流公司不被京东支持!}]]></Cause></Rsp>"); } if (OrderHelper.SendAPIGoods(orderInfo, true)) { string text4 = ""; if (orderInfo.Gateway == "hishop.plugins.payment.weixinrequest") { try { SiteSettings masterSettings = SettingsManager.GetMasterSettings(); PayClient payClient = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, masterSettings.WeixinPaySignKey, "", "", ""); DeliverInfo deliverInfo = new DeliverInfo(); deliverInfo.TransId = orderInfo.GatewayOrderId; deliverInfo.OutTradeNo = orderInfo.OrderId; MemberOpenIdInfo memberOpenIdInfo = Users.GetUser(orderInfo.UserId).MemberOpenIds.FirstOrDefault((MemberOpenIdInfo item) => item.OpenIdType.ToLower() == "hishop.plugins.openid.weixin"); if (memberOpenIdInfo != null) { deliverInfo.OpenId = memberOpenIdInfo.OpenId; } payClient.DeliverNotify(deliverInfo); } catch (Exception ex) { dictionary["ErrrorMsg"] = "同步微信支付发货状态失败"; Globals.WriteExceptionLog(ex, dictionary, "APISendGoods"); } } else { if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && orderInfo.GatewayOrderId.Trim().Length > 0) { try { PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.Gateway); if (paymentMode != null && !string.IsNullOrEmpty(paymentMode.Settings)) { string hIGW = paymentMode.Gateway.Replace(".", "_"); PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.PayOrderId, orderInfo.GetTotal(false), "订单发货", "订单号-" + orderInfo.PayOrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(""), Globals.FullPath(RouteConfig.GetRouteUrl(HttpContext.Current, "PaymentReturn_url", new { HIGW = hIGW })), Globals.FullPath(RouteConfig.GetRouteUrl(HttpContext.Current, "PaymentNotify_url", new { HIGW = hIGW })), ""); paymentRequest.SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS"); } } catch (Exception ex2) { dictionary["ErrrorMsg"] = "同步支付接口发货状态失败"; Globals.WriteExceptionLog(ex2, dictionary, "APISendGoods"); } } if (!string.IsNullOrEmpty(orderInfo.OuterOrderId)) { if (orderInfo.OuterOrderId.StartsWith("tb_")) { string text5 = orderInfo.OuterOrderId.Replace("tb_", ""); try { string requestUriString = $"http://order2.kuaidiangtong.com/UpdateShipping.ashx?tid={text5}&companycode={expressCompanyInfo.TaobaoCode}&outsid={orderInfo.ShipOrderNumber}&Host={HiContext.Current.SiteUrl}"; WebRequest webRequest = WebRequest.Create(requestUriString); webRequest.GetResponse(); } catch (Exception ex3) { dictionary["ErrrorMsg"] = "同步淘宝发货状态失败"; Globals.WriteExceptionLog(ex3, dictionary, "APISendGoods"); } } else if (orderInfo.OuterOrderId.StartsWith("jd_")) { string text5 = orderInfo.OuterOrderId.Replace("jd_", ""); try { SiteSettings masterSettings2 = SettingsManager.GetMasterSettings(); JDHelper.JDOrderOutStorage(masterSettings2.JDAppKey, masterSettings2.JDAppSecret, masterSettings2.JDAccessToken, expressCompanyInfo.JDCode, orderInfo.ShipOrderNumber, text5); } catch (Exception ex4) { dictionary["ErrrorMsg"] = "同步京东发货失败"; Globals.WriteExceptionLog(ex4, dictionary, "APISendGoods"); text4 = $"同步京东发货失败,京东订单号:{text5},{ex4.Message}\r\n"; } } } } MemberInfo user = Users.GetUser(orderInfo.UserId); Messenger.OrderShipping(orderInfo, user); orderInfo.OnDeliver(); return("<?xml version='1.0' encoding='utf-8'?><Rsp><Result>1</Result><Cause></Cause></Rsp>"); } return("<?xml version='1.0' encoding='utf-8'?><Rsp><Result>0</Result><Cause><![CDATA[{发货失败,可能是商品库存不足,订单中有商品正在退货、换货状态!}]]></Cause></Rsp>"); }
private void btnSendGoods_Click(object sender, EventArgs e) { OrderInfo orderInfo = OrderHelper.GetOrderInfo(this.orderId); int num = this.radio_sendGoodType.SelectedValue.ToInt(0); string text = this.txtDeliveryNo.Value.ToNullString(); if (orderInfo != null) { if (orderInfo.OrderStatus == OrderStatus.WaitBuyerPay && OrderHelper.NeedUpdateStockWhenSendGoods(orderInfo) && !OrderHelper.CheckStock(orderInfo)) { this.ShowMsg("订单有商品库存不足,请补充库存后发货!", false); } else if (orderInfo.GroupBuyId > 0 && orderInfo.GroupBuyStatus != GroupBuyStatus.Success) { this.ShowMsg("当前订单为团购订单,团购活动还未成功结束,所以不能发货", false); } else if (!orderInfo.CheckAction(OrderActions.SELLER_SEND_GOODS)) { this.ShowMsg("当前订单状态没有付款或不是等待发货的订单,所以不能发货", false); } else if (num == 2 && text == "") { this.ShowMsg("使用同城物流发货需要正确的物流编号", false); } else { ExpressCompanyInfo expressCompanyInfo = null; if (num == 1 && !string.IsNullOrEmpty(this.expressRadioButtonList.SelectedValue)) { expressCompanyInfo = ExpressHelper.FindNode(this.expressRadioButtonList.SelectedValue); if (expressCompanyInfo != null) { orderInfo.ExpressCompanyAbb = expressCompanyInfo.Kuaidi100Code; orderInfo.ExpressCompanyName = expressCompanyInfo.Name; } orderInfo.ShipOrderNumber = this.txtShipOrderNumber.Text; if (!string.IsNullOrEmpty(orderInfo.OuterOrderId) && !string.IsNullOrEmpty(orderInfo.ShipOrderNumber) && orderInfo.OuterOrderId.StartsWith("jd_") && string.IsNullOrWhiteSpace(expressCompanyInfo.JDCode)) { this.ShowMsg("此订单是京东订单,所选物流公司不被京东支持", false); return; } } else if (num == 2) { orderInfo.ExpressCompanyName = "同城物流配送"; orderInfo.ExpressCompanyAbb = ""; orderInfo.ShipOrderNumber = ""; orderInfo.DadaStatus = DadaStatus.WaitOrder; if (orderInfo.ExpressCompanyName == "同城物流配送" && !string.IsNullOrEmpty(text)) { SiteSettings masterSettings = SettingsManager.GetMasterSettings(); DadaHelper.addAfterQuery(masterSettings.DadaSourceID, text); } } if (OrderHelper.SendGoods(orderInfo)) { if (!string.IsNullOrEmpty(orderInfo.ExpressCompanyAbb) && orderInfo.ExpressCompanyAbb.ToUpper() == "HTKY") { ExpressHelper.GetDataByKuaidi100(orderInfo.ExpressCompanyAbb, orderInfo.ShipOrderNumber); } if (orderInfo.Gateway.ToNullString().ToLower() == "hishop.plugins.payment.podrequest") { ProductStatisticsHelper.UpdateOrderSaleStatistics(orderInfo); TransactionAnalysisHelper.AnalysisOrderTranData(orderInfo); } string text2 = ""; if (orderInfo.Gateway == "hishop.plugins.payment.weixinrequest") { SiteSettings masterSettings2 = SettingsManager.GetMasterSettings(); PayClient payClient = new PayClient(masterSettings2.WeixinAppId, masterSettings2.WeixinAppSecret, masterSettings2.WeixinPartnerID, masterSettings2.WeixinPartnerKey, masterSettings2.WeixinPaySignKey, "", "", ""); DeliverInfo deliverInfo = new DeliverInfo(); deliverInfo.TransId = orderInfo.GatewayOrderId; deliverInfo.OutTradeNo = orderInfo.OrderId; MemberOpenIdInfo memberOpenIdInfo = Users.GetUser(orderInfo.UserId).MemberOpenIds.FirstOrDefault((MemberOpenIdInfo item) => item.OpenIdType.ToLower() == "hishop.plugins.openid.weixin"); if (memberOpenIdInfo != null) { deliverInfo.OpenId = memberOpenIdInfo.OpenId; } payClient.DeliverNotify(deliverInfo); } else { if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && orderInfo.GatewayOrderId.Trim().Length > 0) { try { PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.Gateway); if (paymentMode != null && !string.IsNullOrEmpty(paymentMode.Settings)) { string hIGW = paymentMode.Gateway.Replace(".", "_"); PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(false), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(""), Globals.FullPath(base.GetRouteUrl("PaymentReturn_url", new { HIGW = hIGW })), Globals.FullPath(base.GetRouteUrl("PaymentNotify_url", new { HIGW = hIGW })), ""); paymentRequest.SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS"); } } catch (Exception) { } } if (!string.IsNullOrEmpty(orderInfo.OuterOrderId)) { if (orderInfo.OuterOrderId.StartsWith("tb_")) { string text3 = orderInfo.OuterOrderId.Replace("tb_", ""); try { if (expressCompanyInfo != null) { string requestUriString = $"http://order2.kuaidiangtong.com/UpdateShipping.ashx?tid={text3}&companycode={expressCompanyInfo.TaobaoCode}&outsid={orderInfo.ShipOrderNumber}&Host={HiContext.Current.SiteUrl}"; WebRequest webRequest = WebRequest.Create(requestUriString); webRequest.GetResponse(); } } catch { } } else if (orderInfo.OuterOrderId.StartsWith("jd_") && expressCompanyInfo != null) { string text3 = orderInfo.OuterOrderId.Replace("jd_", ""); try { SiteSettings masterSettings3 = SettingsManager.GetMasterSettings(); JDHelper.JDOrderOutStorage(masterSettings3.JDAppKey, masterSettings3.JDAppSecret, masterSettings3.JDAccessToken, expressCompanyInfo.JDCode, orderInfo.ShipOrderNumber, text3); } catch (Exception ex2) { text2 = $"同步京东发货失败,京东订单号:{text3},{ex2.Message}\r\n"; } } } } MemberInfo user = Users.GetUser(orderInfo.UserId); Messenger.OrderShipping(orderInfo, user); orderInfo.OnDeliver(); if (string.IsNullOrWhiteSpace(text2)) { this.ShowMsg("发货成功", true); StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < base.Request.QueryString.Count && base.Request.QueryString.Keys[i] != null; i++) { string text4 = base.Request.QueryString.Keys[i].ToLower(); string text5 = base.Request.QueryString[text4]; if (!(text4 == "orderid") && !string.IsNullOrEmpty(text5)) { text4 = ((text4 == "searchorderid") ? "orderid" : text4); stringBuilder.Append("&" + text4 + "=" + text5); } } if (string.IsNullOrWhiteSpace(base.JsCallBack)) { base.CloseWindowGo("../sales/manageorder.aspx?1=1" + stringBuilder.ToString()); } else { base.CloseWindow(null); } } else { this.ShowMsg($"发货成功\r\n{text2}", true); } } else { this.ShowMsg("发货失败,可能是商品库存不足,订单中有商品正在退货、换货状态", false); } } } }
protected void Page_Load(object sender, System.EventArgs e) { string orderId = this.Page.Request.QueryString["orderId"]; OrderInfo orderInfo = TradeHelper.GetOrderInfo(orderId); if (orderInfo == null) { base.Response.Write("<div><font color='red'>您要付款的订单已经不存在,请联系管理员确定</font></div>"); return; } if (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay) { this.Page.Response.Write("订单当前状态不能支付"); return; } if (orderInfo.CountDownBuyId > 0) { CountDownInfo countDownInfoByCountDownId = ProductBrowser.GetCountDownInfoByCountDownId(orderInfo.CountDownBuyId); if (countDownInfoByCountDownId == null || countDownInfoByCountDownId.EndDate < System.DateTime.Now) { this.Page.Response.Write("此订单属于限时抢购类型订单,但限时抢购活动已经结束或不存在"); return; } } PaymentModeInfo paymentMode = TradeHelper.GetPaymentMode(orderInfo.PaymentTypeId); if (paymentMode == null) { base.Response.Write("<div><font color='red'>您之前选择的支付方式已经不存在,请联系管理员修改支付方式</font></div>"); return; } System.Collections.Generic.Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems; foreach (LineItemInfo current in lineItems.Values) { int productId = current.ProductId; ProductBrowseInfo productBrowseInfo = ProductBrowser.GetProductBrowseInfo(productId, new int?(6), new int?(6)); if (productBrowseInfo.Product == null || productBrowseInfo.Product.SaleStatus == ProductSaleStatus.Delete) { base.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("订单内商品已经被管理员删除")); return; } if (productBrowseInfo.Product.SaleStatus == ProductSaleStatus.OnStock) { base.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("订单内商品已入库")); return; } ProductInfo product = productBrowseInfo.Product; int stock = product.Stock; int shipmentQuantity = current.ShipmentQuantity; if (shipmentQuantity > stock) { base.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("订单内商品库存不足")); return; } } string showUrl = Globals.GetSiteUrls().UrlData.FormatUrl("user_UserOrders"); if (paymentMode.Gateway.ToLower() != "hishop.plugins.payment.podrequest") { showUrl = base.Server.UrlEncode(string.Format("http://{0}/user/OrderDetails.aspx?OrderId={1}", base.Request.Url.Host, orderInfo.OrderId)); } if (string.Compare(paymentMode.Gateway, "Hishop.Plugins.Payment.BankRequest", true) == 0) { showUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("bank_pay", new object[] { orderInfo.OrderId })); } if (string.Compare(paymentMode.Gateway, "Hishop.Plugins.Payment.AdvanceRequest", true) == 0) { showUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("advance_pay", new object[] { orderInfo.OrderId })); } string attach = ""; System.Web.HttpCookie httpCookie = Hidistro.Membership.Context.HiContext.Current.Context.Request.Cookies["Token_" + Hidistro.Membership.Context.HiContext.Current.User.UserId.ToString()]; if (httpCookie != null && !string.IsNullOrEmpty(httpCookie.Value)) { attach = httpCookie.Value; } PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单支付", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, showUrl, Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[] { paymentMode.Gateway })), attach); paymentRequest.SendRequest(); }
private void btnSendGoods_Click(object sender, EventArgs e) { OrderInfo orderInfo = OrderHelper.GetOrderInfo(this.orderId); if (orderInfo != null) { if (orderInfo.OrderStatus == OrderStatus.WaitBuyerPay && OrderHelper.NeedUpdateStockWhenSendGoods(orderInfo) && !OrderHelper.CheckStock(orderInfo)) { this.ShowMsg("订单有商品库存不足,请补充库存后发货!", false); } else if (orderInfo.GroupBuyId > 0 && orderInfo.GroupBuyStatus != GroupBuyStatus.Success) { this.ShowMsg("当前订单为团购订单,团购活动还未成功结束,所以不能发货", false); } else if (!orderInfo.CheckAction(OrderActions.SELLER_SEND_GOODS)) { this.ShowMsg("当前订单状态没有付款或不是等待发货的订单,所以不能发货", false); } else { ExpressCompanyInfo expressCompanyInfo = null; if (!string.IsNullOrEmpty(this.expressRadioButtonList.SelectedValue)) { expressCompanyInfo = ExpressHelper.FindNode(this.expressRadioButtonList.SelectedValue); if (expressCompanyInfo != null) { orderInfo.ExpressCompanyAbb = expressCompanyInfo.Kuaidi100Code; orderInfo.ExpressCompanyName = expressCompanyInfo.Name; } orderInfo.ShipOrderNumber = this.txtShipOrderNumber.Text; if (!string.IsNullOrEmpty(orderInfo.OuterOrderId) && orderInfo.OuterOrderId.StartsWith("jd_") && string.IsNullOrWhiteSpace(expressCompanyInfo.JDCode)) { this.ShowMsg("此订单是京东订单,所选物流公司不被京东支持", false); return; } } if (OrderHelper.SendGoods(orderInfo)) { if (!string.IsNullOrEmpty(orderInfo.ExpressCompanyAbb) && orderInfo.ExpressCompanyAbb.ToUpper() == "HTKY") { ExpressHelper.GetDataByKuaidi100(orderInfo.ExpressCompanyAbb, orderInfo.ShipOrderNumber); } string text = ""; if (orderInfo.Gateway == "hishop.plugins.payment.weixinrequest") { SiteSettings masterSettings = SettingsManager.GetMasterSettings(); PayClient payClient = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, masterSettings.WeixinPaySignKey, "", "", ""); DeliverInfo deliverInfo = new DeliverInfo(); deliverInfo.TransId = orderInfo.GatewayOrderId; deliverInfo.OutTradeNo = orderInfo.OrderId; MemberOpenIdInfo memberOpenIdInfo = Users.GetUser(orderInfo.UserId).MemberOpenIds.FirstOrDefault((MemberOpenIdInfo item) => item.OpenIdType.ToLower() == "hishop.plugins.openid.weixin"); if (memberOpenIdInfo != null) { deliverInfo.OpenId = memberOpenIdInfo.OpenId; } payClient.DeliverNotify(deliverInfo); } else { if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && orderInfo.GatewayOrderId.Trim().Length > 0) { try { PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.Gateway); if (paymentMode != null && !string.IsNullOrEmpty(paymentMode.Settings)) { string hIGW = paymentMode.Gateway.Replace(".", "_"); PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(false), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(""), Globals.FullPath(base.GetRouteUrl("PaymentReturn_url", new { HIGW = hIGW })), Globals.FullPath(base.GetRouteUrl("PaymentNotify_url", new { HIGW = hIGW })), ""); paymentRequest.SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS"); } } catch (Exception) { } } if (!string.IsNullOrEmpty(orderInfo.OuterOrderId) && expressCompanyInfo != null) { if (orderInfo.OuterOrderId.StartsWith("tb_")) { string text2 = orderInfo.OuterOrderId.Replace("tb_", ""); try { string requestUriString = $"http://order2.kuaidiangtong.com/UpdateShipping.ashx?tid={text2}&companycode={expressCompanyInfo.TaobaoCode}&outsid={orderInfo.ShipOrderNumber}&Host={HiContext.Current.SiteUrl}"; WebRequest webRequest = WebRequest.Create(requestUriString); webRequest.GetResponse(); } catch { } } else if (orderInfo.OuterOrderId.StartsWith("jd_") && expressCompanyInfo != null) { string text2 = orderInfo.OuterOrderId.Replace("jd_", ""); try { SiteSettings masterSettings2 = SettingsManager.GetMasterSettings(); JDHelper.JDOrderOutStorage(masterSettings2.JDAppKey, masterSettings2.JDAppSecret, masterSettings2.JDAccessToken, expressCompanyInfo.JDCode, orderInfo.ShipOrderNumber, text2); } catch (Exception ex2) { text = $"\r\n同步京东发货失败,京东订单号:{text2},{ex2.Message}\r\n"; } } } } MemberInfo user = Users.GetUser(orderInfo.UserId); Messenger.OrderShipping(orderInfo, user); orderInfo.OnDeliver(); if (string.IsNullOrWhiteSpace(text)) { this.ShowMsg("发货成功", true); this.CloseWindow("../sales/manageorder.aspx"); } else { this.ShowMsg($"发货成功{text}", true); } } else { this.ShowMsg("发货失败,可能是商品库存不足,订单中有商品正在退货、换货状态", false); } } } }
protected override void AttachChildControls() { this.orderId = this.Page.Request.QueryString["orderId"]; System.Collections.Generic.List <OrderInfo> orderMarkingOrderInfo = ShoppingProcessor.GetOrderMarkingOrderInfo(this.orderId, false); decimal d = 0m; decimal num = 0m; if (orderMarkingOrderInfo.Count == 0) { this.Page.Response.Redirect("/Vshop/MemberOrders.aspx?status=0"); } bool flag = true; foreach (OrderInfo current in orderMarkingOrderInfo) { d += current.GetTotal(); num += current.GetBalancePayMoneyTotal(); foreach (LineItemInfo current2 in current.LineItems.Values) { if (current2.Type == 0) { flag = false; } foreach (LineItemInfo current3 in current.LineItems.Values) { if (!ProductHelper.GetProductHasSku(current3.SkuId, current3.Quantity)) { current.OrderStatus = OrderStatus.Closed; current.CloseReason = "库存不足"; OrderHelper.UpdateOrder(current); System.Web.HttpContext.Current.Response.Write("<script>alert('库存不足,订单自动关闭!');location.href='/Vshop/MemberOrders.aspx'</script>"); System.Web.HttpContext.Current.Response.End(); return; } } } } string text = this.Page.Request.Url.ToString().ToLower(); int num2 = Globals.RequestQueryNum("IsAlipay"); string userAgent = this.Page.Request.UserAgent; if (num2 != 1 && userAgent.ToLower().Contains("micromessenger") && !string.IsNullOrEmpty(orderMarkingOrderInfo[0].Gateway) && orderMarkingOrderInfo[0].Gateway == "hishop.plugins.payment.ws_wappay.wswappayrequest") { this.Page.Response.Redirect("/Pay/IframeAlipay.aspx?OrderId=" + this.orderId); } else { if (!string.IsNullOrEmpty(orderMarkingOrderInfo[0].Gateway) && orderMarkingOrderInfo[0].Gateway == "hishop.plugins.payment.offlinerequest") { this.litMessage = (System.Web.UI.WebControls.Literal) this.FindControl("litMessage"); this.litMessage.SetWhenIsNotNull(SettingsManager.GetMasterSettings(false).OffLinePayContent); } this.litOPertorList = (System.Web.UI.WebControls.Literal) this.FindControl("litOPertorList"); this.litOPertorList.Text = "<div class=\"btns mt20\"><a id=\"linkToDetail\" class=\"btn btn-default mr10\" role=\"button\">查看订单</a><a href=\"/Default.aspx\" class=\"btn btn-default\" role=\"button\">继续逛逛</a></div>"; if (!string.IsNullOrEmpty(orderMarkingOrderInfo[0].Gateway) && orderMarkingOrderInfo[0].Gateway == "hishop.plugins.payment.weixinrequest") { string text2 = "立即支付"; if (num > 0m && d - num > 0m) { text2 = "还需支付 " + (d - num).ToString("F2"); } this.litOPertorList.Text = string.Concat(new string[] { "<div class=\"mt20\"><a href=\"/pay/wx_Submit.aspx?orderId=", this.orderId, "\" class=\"btn btn-danger\" role=\"button\" id=\"btnToPay\">", text2, "</a></div>" }); } if (!string.IsNullOrEmpty(orderMarkingOrderInfo[0].Gateway) && orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.podrequest" && orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.offlinerequest" && orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.weixinrequest" && orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.balancepayrequest" && orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.pointtocach" && orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.coupontocach") { PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(orderMarkingOrderInfo[0].PaymentTypeId); string attach = ""; string showUrl = string.Format("http://{0}/vshop/", System.Web.HttpContext.Current.Request.Url.Host); PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), this.orderId, d - num, "订单支付", "订单号-" + this.orderId, orderMarkingOrderInfo[0].EmailAddress, orderMarkingOrderInfo[0].OrderDate, showUrl, Globals.FullPath("/pay/PaymentReturn_url.aspx"), Globals.FullPath("/pay/PaymentNotify_url.aspx"), attach); paymentRequest.SendRequest(); } else { this.litOrderId = (System.Web.UI.WebControls.Literal) this.FindControl("litOrderId"); this.litOrderTotal = (System.Web.UI.WebControls.Literal) this.FindControl("litOrderTotal"); this.literalOrderTotal = (System.Web.UI.WebControls.Literal) this.FindControl("literalOrderTotal"); this.literalBalancePayInfo = (System.Web.UI.WebControls.Literal) this.FindControl("literalBalancePayInfo"); this.litPaymentType = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("litPaymentType"); int num3 = 0; this.litPaymentType.SetWhenIsNotNull("0"); if (int.TryParse(this.Page.Request.QueryString["PaymentType"], out num3)) { this.litPaymentType.SetWhenIsNotNull(num3.ToString()); } this.litOrderId.SetWhenIsNotNull(this.orderId); if (flag) { this.litOrderTotal.SetWhenIsNotNull("您需要支付:¥" + d.ToString("F2")); } this.literalOrderTotal.SetWhenIsNotNull("订单金额:<span role='orderTotal' style='color:red'>¥" + d.ToString("F2") + "</span>"); if (num > 0m) { this.literalBalancePayInfo.Text = "<div class='font-xl'>余额已支付:<span style='color:red'>¥" + num.ToString("F2") + "</span></div>"; } this.litHelperText = (System.Web.UI.WebControls.Literal) this.FindControl("litHelperText"); SiteSettings masterSettings = SettingsManager.GetMasterSettings(false); this.litHelperText.SetWhenIsNotNull(masterSettings.OffLinePayContent); PageTitle.AddSiteNameTitle("下单成功"); } } }
protected void btnBatchSend_Click(object sender, System.EventArgs e)//新增上传excel来发货 { this.btnBatchSend.Enabled = false; HttpPostedFile file = this.excelFile.PostedFile; if (file.ContentLength == 0) { this.btnBatchSend.Enabled = true; this.ShowMsg("请选择文件!", false); return; } string expandName = file.FileName.Substring(file.FileName.LastIndexOf('.') + 1); int excelType = 0; if (expandName == "xls") { excelType = 1; } else if (expandName == "xlsx") { excelType = 2; } else { this.btnBatchSend.Enabled = true; this.ShowMsg("请上传excel文件!", false); return; } ExcelHelper excelHelper = new ExcelHelper(file.InputStream); DataTable dtExcel = excelHelper.ExcelToDataTable("", true, excelType); if (dtExcel == null || dtExcel.Columns.Count < 4) { this.btnBatchSend.Enabled = true; this.ShowMsg("excel表格列数错误!", false); return; } if (!(dtExcel.Columns[0].ToString() == "订单编号" && dtExcel.Columns[1].ToString() == "发货时间" && dtExcel.Columns[2].ToString() == "快递公司" && dtExcel.Columns[3].ToString() == "快递单号")) { this.btnBatchSend.Enabled = true; this.ShowMsg("excel表格列名称错误!", false); return; } List <string> orderIds = new List <string>(); List <string> expressCompanyName = new List <string>(); List <string> ShipOrderNumber = new List <string>(); List <DateTime> deliveryTimes = new List <DateTime>(); Dictionary <string, string> deliverFailOrders = new Dictionary <string, string>(); List <deliverFailOrderInfo> listdeliverFailOrderInfo = new List <deliverFailOrderInfo>(); int num = 0; #region 整理发货单数据 if (dtExcel != null) { int count = dtExcel.Rows.Count; for (int i = 0; i < count; i++) { string tmpOrderId = string.Empty; string tmpexpressCompanyName = string.Empty; string tmpkuaidi100Code = string.Empty; DateTime tmpdeliveryTime = DateTime.Now; tmpOrderId = dtExcel.Rows[i][0].ToString(); DateTime.TryParse(dtExcel.Rows[i][1].ToString(), out tmpdeliveryTime); tmpexpressCompanyName = dtExcel.Rows[i][2].ToString(); tmpkuaidi100Code = dtExcel.Rows[i][3].ToString(); string[] singleLineOrderIds = tmpOrderId.Split(',');//单行可能多个订单号 for (int j = 0; j < singleLineOrderIds.Length; j++) { tmpOrderId = singleLineOrderIds[j]; if (string.IsNullOrEmpty(tmpOrderId)) { continue; } orderIds.Add(tmpOrderId); deliveryTimes.Add(tmpdeliveryTime); expressCompanyName.Add(tmpexpressCompanyName); ShipOrderNumber.Add(tmpkuaidi100Code); } } } #endregion #region 发货业务逻辑处理 for (int i = 0; i < orderIds.Count; i++) { deliverFailOrderInfo failOrderInfo = null; if (string.IsNullOrEmpty(orderIds[i]) && string.IsNullOrEmpty(expressCompanyName[i]) && string.IsNullOrEmpty(ShipOrderNumber[i])) { if (!deliverFailOrders.ContainsKey(orderIds[i])) { failOrderInfo = new deliverFailOrderInfo(); failOrderInfo.OrderId = orderIds[i]; failOrderInfo.FailInfo = "订单号、快递公司或快递单号不能为空"; failOrderInfo.ExpressCompanyCode = ShipOrderNumber[i]; failOrderInfo.ExpressCompanyName = expressCompanyName[i]; listdeliverFailOrderInfo.Add(failOrderInfo); deliverFailOrders.Add(orderIds[i], "订单号、快递公司或快递单号不能为空"); continue; } } OrderInfo orderInfo = OrderHelper.GetOrderInfo(orderIds[i]); if (orderInfo == null) { if (!deliverFailOrders.ContainsKey(orderIds[i])) { failOrderInfo = new deliverFailOrderInfo(); failOrderInfo.OrderId = orderIds[i]; failOrderInfo.FailInfo = "不存在该订单"; failOrderInfo.ExpressCompanyCode = ShipOrderNumber[i]; failOrderInfo.ExpressCompanyName = expressCompanyName[i]; listdeliverFailOrderInfo.Add(failOrderInfo); deliverFailOrders.Add(orderIds[i], "不存在该订单"); } continue; } if ((orderInfo.GroupBuyId <= 0 || orderInfo.GroupBuyStatus == GroupBuyStatus.Success) && ((orderInfo.OrderStatus == OrderStatus.WaitBuyerPay && orderInfo.Gateway == "hishop.plugins.payment.podrequest") || orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid)) { string exCompanyName = expressCompanyName[i]; ShippingModeInfo shippingModeByCompany = SalesHelper.GetShippingModeByCompany(exCompanyName); if (shippingModeByCompany != null) { if (shippingModeByCompany.ModeId > 0) { orderInfo.RealModeName = shippingModeByCompany.Name; orderInfo.RealShippingModeId = shippingModeByCompany.ModeId; } else { orderInfo.RealShippingModeId = 2;//配送方式 orderInfo.RealModeName = "圆通"; } } else { orderInfo.RealShippingModeId = 2;//配送方式 orderInfo.RealModeName = "圆通"; } ExpressCompanyInfo expressCompanyInfo = ExpressHelper.FindNode(expressCompanyName[i]);//物流公司 if (expressCompanyInfo == null) { if (!deliverFailOrders.ContainsKey(orderIds[i])) { failOrderInfo = new deliverFailOrderInfo(); failOrderInfo.OrderId = orderIds[i]; failOrderInfo.FailInfo = "不存在物流公司"; failOrderInfo.ExpressCompanyCode = ShipOrderNumber[i]; failOrderInfo.ExpressCompanyName = expressCompanyName[i]; listdeliverFailOrderInfo.Add(failOrderInfo); deliverFailOrders.Add(orderIds[i], "不存在物流公司"); } continue; } orderInfo.ExpressCompanyName = expressCompanyInfo.Name; orderInfo.ExpressCompanyAbb = expressCompanyInfo.Kuaidi100Code; orderInfo.ShipOrderNumber = ShipOrderNumber[i]; orderInfo.ShippingDate = deliveryTimes[i]; //todo 发货时间 if (OrderHelper.SendGoods(orderInfo)) { SendNoteInfo sendNoteInfo = new SendNoteInfo(); sendNoteInfo.NoteId = Globals.GetGenerateId() + num; sendNoteInfo.OrderId = orderIds[i]; sendNoteInfo.Operator = HiContext.Current.User.Username; sendNoteInfo.Remark = "后台" + sendNoteInfo.Operator + "发货成功"; OrderHelper.SaveSendNote(sendNoteInfo); if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && orderInfo.GatewayOrderId.Trim().Length > 0) { PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.Gateway); if (paymentMode != null && !string.IsNullOrEmpty(paymentMode.Settings) && paymentMode.Settings != "1hSUSkKQ/ENo0JDZah8KKQweixin") { PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[] { paymentMode.Gateway })), ""); if (paymentRequest != null) { paymentRequest.SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS"); } } } if (!string.IsNullOrEmpty(orderInfo.TaobaoOrderId)) { try { string requestUriString = string.Format("http://order2.ecdev.cn/UpdateShipping.ashx?tid={0}&companycode={1}&outsid={2}&Host={3}", new object[] { orderInfo.TaobaoOrderId, expressCompanyInfo.TaobaoCode, orderInfo.ShipOrderNumber, HiContext.Current.SiteUrl }); System.Net.WebRequest webRequest = System.Net.WebRequest.Create(requestUriString); webRequest.GetResponse(); } catch { } } int num3 = orderInfo.UserId; if (num3 == 1100) { num3 = 0; } IUser user = Users.GetUser(num3); Messenger.OrderShipping(orderInfo, user); orderInfo.OnDeliver(); num++; } else { if (!deliverFailOrders.ContainsKey(orderIds[i])) { failOrderInfo = new deliverFailOrderInfo(); failOrderInfo.OrderId = orderIds[i]; failOrderInfo.FailInfo = "发货失败"; failOrderInfo.ExpressCompanyCode = ShipOrderNumber[i]; failOrderInfo.ExpressCompanyName = expressCompanyName[i]; listdeliverFailOrderInfo.Add(failOrderInfo); deliverFailOrders.Add(orderIds[i], "发货失败"); } } } else { if (!deliverFailOrders.ContainsKey(orderIds[i])) { failOrderInfo = new deliverFailOrderInfo(); failOrderInfo.OrderId = orderIds[i]; failOrderInfo.FailInfo = "该订单不满足发货条件"; failOrderInfo.ExpressCompanyCode = ShipOrderNumber[i]; failOrderInfo.ExpressCompanyName = expressCompanyName[i]; listdeliverFailOrderInfo.Add(failOrderInfo); deliverFailOrders.Add(orderIds[i], "该订单不满足发货条件"); } } } #endregion #region 失败订单抛出 if (deliverFailOrders.Count > 0) { System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); stringBuilder.AppendLine("<html><head><meta http-equiv=Content-Type content=\"text/html; charset=gb2312\"></head><body>"); stringBuilder.AppendLine("<table cellspacing=\"0\" cellpadding=\"5\" rules=\"all\" border=\"1\">"); stringBuilder.AppendLine("<caption style='text-align:center;'>发货未成功订单列表</caption>"); stringBuilder.AppendLine("<tr style=\"font-weight: bold; white-space: nowrap;\">"); stringBuilder.AppendLine("<td>订单号</td>"); stringBuilder.AppendLine("<td>物流公司</td>"); stringBuilder.AppendLine("<td>物流单号</td>"); stringBuilder.AppendLine("<td>错误信息</td>"); stringBuilder.AppendLine("</tr>"); foreach (deliverFailOrderInfo failOrderInfo in listdeliverFailOrderInfo) { stringBuilder.AppendLine("<tr>"); stringBuilder.AppendLine(string.Format("<td style=\"vnd.ms-excel.numberformat:@\">{0}</td>", failOrderInfo.OrderId)); stringBuilder.AppendLine(string.Format("<td style=\"vnd.ms-excel.numberformat:@\">{0}</td>", failOrderInfo.ExpressCompanyName)); stringBuilder.AppendLine(string.Format("<td style=\"vnd.ms-excel.numberformat:@\">{0}</td>", failOrderInfo.ExpressCompanyCode)); stringBuilder.AppendLine(string.Format("<td style=\"vnd.ms-excel.numberformat:@\">{0}</td>", failOrderInfo.FailInfo)); stringBuilder.AppendLine("</tr>"); } stringBuilder.AppendLine("</table>"); stringBuilder.AppendLine("</body></html>"); base.Response.Clear(); base.Response.Buffer = false; base.Response.Charset = "GB2312"; base.Response.AppendHeader("Content-Disposition", "attachment;filename=发货未成功订单_" + System.DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls"); base.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312"); base.Response.ContentType = "application/ms-excel"; this.EnableViewState = false; base.Response.Write(stringBuilder.ToString()); } #endregion this.btnBatchSend.Enabled = true; this.ShowMsg("操作完成!", true); //base.Response.End(); }
public string SendLogistic(string tid, string company_name, string out_sid) { OrderInfo orderInfo = OrderHelper.GetOrderInfo(tid); if (orderInfo == null || string.IsNullOrEmpty(orderInfo.OrderId)) { return(OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Trade_not_Exists, "tid")); } if (orderInfo.GroupBuyId > 0 && orderInfo.GroupBuyStatus != GroupBuyStatus.Success) { return(OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Trade_Status_Send, "group order")); } if (!orderInfo.CheckAction(OrderActions.SELLER_SEND_GOODS)) { return(OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Trade_Status_Send, "orderstatue")); } if (string.IsNullOrEmpty(out_sid)) { return(OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Missing_Required_Arguments, "out_sid")); } ExpressCompanyInfo expressCompanyInfo = ExpressHelper.FindNode(company_name); if (expressCompanyInfo == null) { return(OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Company_not_Exists, "company_name")); } orderInfo.ExpressCompanyAbb = expressCompanyInfo.Kuaidi100Code; orderInfo.ExpressCompanyName = expressCompanyInfo.Name; orderInfo.ShipOrderNumber = out_sid; if (!OrderHelper.SendGoods(orderInfo)) { return(OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Trade_Status_Send, "send good")); } Express.SubscribeExpress100(orderInfo.ExpressCompanyAbb, out_sid); OrderHelper.SaveSendNote(new SendNoteInfo { NoteId = Globals.GetGenerateId(), OrderId = orderInfo.OrderId, Operator = orderInfo.UserId.ToString(), Remark = "接口发货成功" }); if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && orderInfo.GatewayOrderId.Trim().Length > 0) { if (orderInfo.Gateway == "hishop.plugins.payment.ws_wappay.wswappayrequest") { PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.PaymentTypeId); if (paymentMode != null) { PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[] { paymentMode.Gateway })), ""); paymentRequest.SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS"); } } if (orderInfo.Gateway == "hishop.plugins.payment.weixinrequest") { SiteSettings masterSettings = SettingsManager.GetMasterSettings(false); PayClient payClient; if (masterSettings.EnableSP) { payClient = new PayClient(masterSettings.Main_AppId, masterSettings.WeixinAppSecret, masterSettings.Main_Mch_ID, masterSettings.Main_PayKey, true, masterSettings.WeixinAppId, masterSettings.WeixinPartnerID); } else { payClient = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, false, "", ""); } payClient.DeliverNotify(new DeliverInfo { TransId = orderInfo.GatewayOrderId, OutTradeNo = orderInfo.OrderId, OpenId = MemberHelper.GetMember(orderInfo.UserId).OpenId }); } } orderInfo.OnDeliver(); string format = "{{\"logistics_send_response\":{{\"shipping\":{{\"is_success\":{0}}}}}}}"; return(string.Format(format, "true")); }
protected override void AttachChildControls() { this.orderId = this.Page.Request.QueryString["orderId"]; InsuranceOrderInfo info = dao.GetModel(Convert.ToInt32(this.orderId)); decimal num = 0M; decimal num2 = 0M; num = info.InsuranceOrderAmount.Value; if (info == null) { this.Page.Response.Redirect("/Vshop/MemberInsuranceOrders.aspx"); } bool flag = true; if (info.InsuranceOrderStatu != 2) { HttpContext.Current.Response.Write("<script>alert('未报价订单无法支付!');location.href='/Vshop/MemberInsuranceOrders.aspx'</script>"); HttpContext.Current.Response.End(); } string gateway = "hishop.plugins.payment.weixinrequest"; int PaymentTypeId = 88; this.Page.Request.Url.ToString().ToLower(); int num3 = Globals.RequestQueryNum("IsAlipay"); string userAgent = this.Page.Request.UserAgent; if (((num3 == 1) || !userAgent.ToLower().Contains("micromessenger")) || (string.IsNullOrEmpty(gateway) || !(gateway == "hishop.plugins.payment.ws_wappay.wswappayrequest"))) { if (!string.IsNullOrEmpty(gateway) && (gateway == "hishop.plugins.payment.offlinerequest")) { this.litMessage = (Literal)this.FindControl("litMessage"); this.litMessage.SetWhenIsNotNull(SettingsManager.GetMasterSettings(false).OffLinePayContent); } this.litOPertorList = (Literal)this.FindControl("litOPertorList"); this.litOPertorList.Text = "<div class=\"btns mt20\"><a id=\"linkToDetail\" class=\"btn btn-default mr10\" role=\"button\">查看订单</a><a href=\"/Default.aspx\" class=\"btn btn-default\" role=\"button\">继续逛逛</a></div>"; if (!string.IsNullOrEmpty(gateway) && (gateway == "hishop.plugins.payment.weixinrequest")) { string str2 = "立即支付"; if ((num2 > 0M) && ((num - num2) > 0M)) { str2 = "还需支付 " + ((num - num2)).ToString("F2"); } this.litOPertorList.Text = "<div class=\"mt20\"><a href=\"/pay/wx_Submit.aspx?orderId=" + this.orderId + "\" class=\"btn btn-danger\" role=\"button\" id=\"btnToPay\">" + str2 + "</a></div>"; } if (((!string.IsNullOrEmpty(gateway) && (gateway != "hishop.plugins.payment.podrequest")) && ((gateway != "hishop.plugins.payment.offlinerequest") && (gateway != "hishop.plugins.payment.weixinrequest"))) && (((gateway != "hishop.plugins.payment.balancepayrequest") && (gateway != "hishop.plugins.payment.pointtocach")) && (gateway != "hishop.plugins.payment.coupontocach"))) { PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(PaymentTypeId); string attach = ""; string showUrl = string.Format("http://{0}/vshop/", HttpContext.Current.Request.Url.Host); PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), this.orderId, num - num2, "订单支付", "订单号-" + this.orderId, "*****@*****.**", info.InsuranceOrderCreatDate.Value, showUrl, Globals.FullPath("/pay/PaymentReturn_url.aspx"), Globals.FullPath("/pay/PaymentNotify_url.aspx"), attach).SendRequest(); } else { this.litOrderId = (Literal)this.FindControl("litOrderId"); this.litOrderTotal = (Literal)this.FindControl("litOrderTotal"); this.literalOrderTotal = (Literal)this.FindControl("literalOrderTotal"); this.literalBalancePayInfo = (Literal)this.FindControl("literalBalancePayInfo"); this.litPaymentType = (HtmlInputHidden)this.FindControl("litPaymentType"); int result = 0; this.litPaymentType.SetWhenIsNotNull("0"); if (int.TryParse(this.Page.Request.QueryString["PaymentType"], out result)) { this.litPaymentType.SetWhenIsNotNull(result.ToString()); } this.litOrderId.SetWhenIsNotNull(this.orderId); if (flag) { this.litOrderTotal.SetWhenIsNotNull("您需要支付:\x00a5" + num.ToString("F2")); } this.literalOrderTotal.SetWhenIsNotNull("订单金额:<span style='color:red'>\x00a5" + num.ToString("F2") + "</span>"); if (num2 > 0M) { this.literalBalancePayInfo.Text = "<div class='font-xl'>余额已支付:<span style='color:red'>\x00a5" + num2.ToString("F2") + "</span></div>"; } this.litHelperText = (Literal)this.FindControl("litHelperText"); SiteSettings masterSettings = SettingsManager.GetMasterSettings(false); this.litHelperText.SetWhenIsNotNull(masterSettings.OffLinePayContent); PageTitle.AddSiteNameTitle("下单成功"); } } else { this.Page.Response.Redirect("/Pay/IframeAlipay.aspx?OrderId=" + this.orderId); } }