private void ProcessUnUpsellingSku(System.Web.HttpContext context) { context.Response.ContentType = "application/json"; int productId = int.Parse(context.Request["productId"], System.Globalization.NumberStyles.None); int attributeId = int.Parse(context.Request["AttributeId"], System.Globalization.NumberStyles.None); int valueId = int.Parse(context.Request["ValueId"], System.Globalization.NumberStyles.None); DataTable unUpUnUpsellingSkus = ShoppingProcessor.GetUnUpUnUpsellingSkus(productId, attributeId, valueId); if (unUpUnUpsellingSkus == null || unUpUnUpsellingSkus.Rows.Count == 0) { context.Response.Write("{\"Status\":\"1\"}"); return; } int stock = ShoppingProcessor.GetSkusStock(productId, attributeId, valueId); System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); stringBuilder.Append("{"); stringBuilder.Append("\"Status\":\"OK\","); stringBuilder.AppendFormat("\"Stock\":\"{0}\",", stock); stringBuilder.Append("\"SkuItems\":["); foreach (DataRow dataRow in unUpUnUpsellingSkus.Rows) { stringBuilder.Append("{"); stringBuilder.AppendFormat("\"AttributeId\":\"{0}\",", dataRow["AttributeId"].ToString()); stringBuilder.AppendFormat("\"ValueId\":\"{0}\"", dataRow["ValueId"].ToString()); stringBuilder.Append("},"); } stringBuilder.Remove(stringBuilder.Length - 1, 1); stringBuilder.Append("]"); stringBuilder.Append("}"); context.Response.Write(stringBuilder.ToString()); }
protected void Page_Load(object sender, System.EventArgs e) { System.Collections.Specialized.NameValueCollection parameters = new System.Collections.Specialized.NameValueCollection { this.Page.Request.Form, this.Page.Request.QueryString }; this.Gateway = "Ecdev.Plugins.Payment.ShengPayMobile.ShengPayMobileRequest"; this.Notify = PaymentNotify.CreateInstance(this.Gateway, parameters); this.OrderId = this.Notify.GetOrderId(); this.Order = ShoppingProcessor.GetOrderInfo(this.OrderId); if (this.Order == null) { base.Response.Write("<p style=\"font-size:16px;\">找不到对应的订单,你付款的订单可能已经被删除</p>"); return; } this.Amount = this.Notify.GetOrderAmount(); if (this.Amount <= 0m) { this.Amount = this.Order.GetTotal(); } this.Order.GatewayOrderId = this.Notify.GetGatewayOrderId(); PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode("Ecdev.Plugins.Payment.ShengPayMobile.ShengPayMobileRequest"); if (paymentMode == null) { base.Response.Write("<p style=\"font-size:16px;\">找不到对应的支付方式,该支付方式可能已经被删除</p>"); return; } this.Notify.Finished += new System.EventHandler <FinishedEventArgs>(this.Notify_Finished); this.Notify.NotifyVerifyFaild += new System.EventHandler(this.Notify_NotifyVerifyFaild); this.Notify.Payment += new System.EventHandler(this.Notify_Payment); this.Notify.VerifyNotify(30000, HiCryptographer.Decrypt(paymentMode.Settings)); }
private void DoValidate() { NameValueCollection values2 = new NameValueCollection(); values2.Add(this.Page.Request.Form); values2.Add(this.Page.Request.QueryString); NameValueCollection parameters = values2; if (!this.isBackRequest) { parameters.Add("IsReturn", "true"); } this.Gateway = "hishop.plugins.payment.ws_wappay.wswappayrequest"; this.Notify = PaymentNotify.CreateInstance(this.Gateway, parameters); if (this.isBackRequest) { this.Notify.ReturnUrl = Globals.FullPath("/pay/PaymentReturn_url.aspx") + "?" + this.Page.Request.Url.Query; } this.OrderId = this.Notify.GetOrderId(); string gatewayOrderId = this.Notify.GetGatewayOrderId(); if (string.IsNullOrEmpty(this.OrderId)) { Globals.Debuglog(" OrderId:没获取到,GetewayOrderId:" + gatewayOrderId, "_DebuglogPaymentTest.txt"); this.ResponseStatus(true, "noorderId"); } else { this.orderlist = ShoppingProcessor.GetOrderMarkingOrderInfo(this.OrderId, false); if (this.orderlist.Count == 0) { Globals.Debuglog("更新订单失败,也许是订单已后台付款,OrderId:" + this.OrderId, "_DebugAlipayPayNotify.txt"); this.ResponseStatus(true, "nodata"); } else { int modeId = 0; foreach (OrderInfo info in this.orderlist) { this.Amount += info.GetTotal(); info.GatewayOrderId = gatewayOrderId; modeId = info.PaymentTypeId; } PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(modeId); if (paymentMode == null) { Globals.Debuglog("gatewaynotfound" + this.OrderId, "_DebugAlipayPayNotify.txt"); this.ResponseStatus(true, "gatewaynotfound"); } else { this.Notify.Finished += new EventHandler <FinishedEventArgs>(this.Notify_Finished); this.Notify.NotifyVerifyFaild += new EventHandler(this.Notify_NotifyVerifyFaild); this.Notify.Payment += new EventHandler(this.Notify_Payment); string configXml = HiCryptographer.Decrypt(paymentMode.Settings); this.Notify.VerifyNotify(0x7530, configXml); } } } }
private void SearchExpressData(System.Web.HttpContext context) { string text = "{"; if (!string.IsNullOrEmpty(context.Request["OrderId"])) { string orderId = context.Request["OrderId"]; OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(orderId); if (orderInfo != null) { bool arg_60_0; if (orderInfo.OrderStatus != OrderStatus.SellerAlreadySent) { if (orderInfo.OrderStatus != OrderStatus.Finished) { arg_60_0 = true; goto IL_60; } } arg_60_0 = string.IsNullOrEmpty(orderInfo.ExpressCompanyAbb); IL_60: if (!arg_60_0) { string expressData = Express.GetExpressData(orderInfo.ExpressCompanyAbb, orderInfo.ShipOrderNumber); text = text + "\"Express\":\"" + expressData + "\""; } } } else { if (!string.IsNullOrEmpty(context.Request["PurchaseOrderId"])) { string purchaseOrderId = context.Request["PurchaseOrderId"]; PurchaseOrderInfo purchaseOrder = ShoppingProcessor.GetPurchaseOrder(purchaseOrderId); if (purchaseOrder != null) { bool arg_E9_0; if (purchaseOrder.PurchaseStatus != OrderStatus.SellerAlreadySent) { if (purchaseOrder.PurchaseStatus != OrderStatus.Finished) { arg_E9_0 = true; goto IL_E9; } } arg_E9_0 = string.IsNullOrEmpty(purchaseOrder.ExpressCompanyAbb); IL_E9: if (!arg_E9_0) { string expressData = Express.GetExpressData(purchaseOrder.ExpressCompanyAbb, purchaseOrder.ShipOrderNumber); text = text + "\"Express\":\"" + expressData + "\""; } } } } text += "}"; context.Response.ContentType = "text/plain"; context.Response.Write(text); context.Response.End(); }
private void GotoPay() { OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(this.orderId); if (orderInfo.Gateway == "Ecdev.plugins.payment.advancerequest") { this.Page.Response.Redirect("TransactionPwd.aspx?orderId=" + this.Page.Request.QueryString["orderId"] + "&totalAmount=" + orderInfo.GetTotal().ToString("F2")); } if (orderInfo.Gateway == "Ecdev.plugins.payment.ws_wappay.wswappayrequest") { PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(orderInfo.Gateway); string attach = ""; string showUrl = string.Format("http://{0}/Wapshop/", System.Web.HttpContext.Current.Request.Url.Host); PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单支付", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, showUrl, Globals.FullPath("/pay/wap_alipay_return_url.aspx"), Globals.FullPath("/pay/wap_alipay_return_url.aspx"), attach); paymentRequest.SendRequest(); return; } if (orderInfo.Gateway == "Ecdev.Plugins.Payment.ShengPayMobile.ShengPayMobileRequest") { PaymentModeInfo paymentMode2 = ShoppingProcessor.GetPaymentMode(orderInfo.Gateway); string attach2 = ""; string text = string.Format("http://{0}/Wapshop/", System.Web.HttpContext.Current.Request.Url.Host); HiCryptographer.Decrypt(paymentMode2.Settings); PaymentRequest paymentRequest2 = PaymentRequest.CreateInstance(paymentMode2.Gateway, HiCryptographer.Decrypt(paymentMode2.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单支付", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, text, text, Globals.FullPath("/pay/wap_sheng_return_url.aspx"), attach2); paymentRequest2.SendRequest(); } }
private void dataSupplier_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem) { return; } Repeater repeater = e.Item.FindControl("rptOrderProducts") as Repeater; repeater.ItemDataBound += this.rptOrderProducts_ItemDataBound; Label label = e.Item.FindControl("lblSupplierAmount") as Label; Label label2 = e.Item.FindControl("lblFreight") as Label; Label label3 = e.Item.FindControl("lblSupplierName") as Label; HtmlGenericControl htmlGenericControl = (HtmlGenericControl)e.Item.FindControl("divSupplier"); HtmlGenericControl htmlGenericControl2 = (HtmlGenericControl)e.Item.FindControl("divFreightAndAmount"); if (repeater != null) { int supplierId = 0; int.TryParse(DataBinder.Eval(e.Item.DataItem, "SupplierId").ToString(), out supplierId); label3.Text = DataBinder.Eval(e.Item.DataItem, "SupplierName").ToString(); List <ShoppingCartItemInfo> list = (from i in this.ShoppingCart.LineItems where i.SupplierId == supplierId select i).ToList(); decimal num = (from i in this.ShoppingCart.LineItems where i.SupplierId == supplierId select i.AdjustedPrice.F2ToString("f2").ToDecimal(0) * (decimal)i.Quantity).Sum(); repeater.DataSource = list; repeater.DataBind(); label.Text = "¥" + num.F2ToString("f2"); decimal num2 = ShoppingProcessor.CalcSupplierFreight(supplierId, this.RegionId, this.ShoppingCart); label2.Text = "¥" + num2.F2ToString("f2") + ((supplierId == 0 && this.ShoppingCart.LineGifts.Count() > 0) ? "(含礼品)" : ""); if (!HiContext.Current.SiteSettings.OpenSupplier) { htmlGenericControl2.Visible = false; } if (HiContext.Current.SiteSettings.OpenMultStore && this.StoreId > 0) { StoresInfo storeById = DepotHelper.GetStoreById(this.StoreId); if (storeById != null) { label3.Text = storeById.StoreName; htmlGenericControl.Attributes["class"] = "mtitle"; } } else if (HiContext.Current.SiteSettings.OpenSupplier && supplierId > 0 && list.Count > 0) { label3.Text = list[0].SupplierName; htmlGenericControl.Attributes["class"] = "stitle"; } else { label3.Text = "平台"; htmlGenericControl.Attributes["class"] = "ztitle"; } } if (HiContext.Current.SiteSettings.OpenMultStore && this.StoreId > 0) { htmlGenericControl2.Visible = false; } }
private void ProcessorUseVoucherByCode(System.Web.HttpContext context) { decimal orderAmount = decimal.Parse(context.Request["CartTotal"]); string claimCode = context.Request["VoucherCode"]; string Password = context.Request["VoucherPassword"]; VoucherInfo voucherInfo = ShoppingProcessor.UseVoucher(orderAmount, claimCode, Password); System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); if (voucherInfo != null) { stringBuilder.Append("{"); stringBuilder.Append("\"Status\":\"OK\","); stringBuilder.AppendFormat("\"VoucherName\":\"{0}\",", voucherInfo.Name); stringBuilder.AppendFormat("\"DiscountValue\":\"{0}\"", Globals.FormatMoney(voucherInfo.DiscountValue)); stringBuilder.Append("}"); } else { stringBuilder.Append("{"); stringBuilder.Append("\"Status\":\"ERROR\""); stringBuilder.Append("}"); } context.Response.ContentType = "application/json"; context.Response.Write(stringBuilder); }
public static decimal GetFreight(ShoppingCartInfo shoppingCartItemInfo, int RegionId, bool isGroupBuy) { int totalQuantity = 0; decimal freight = 0; Dictionary <int, decimal> dictShippingMode = new Dictionary <int, decimal>(); foreach (ShoppingCartItemInfo item in shoppingCartItemInfo.LineItems) { totalQuantity += item.Quantity; if ((!shoppingCartItemInfo.IsFreightFree || !item.IsfreeShipping || isGroupBuy)) { if (item.TemplateId > 0) { if (dictShippingMode.ContainsKey(item.TemplateId)) { dictShippingMode[item.TemplateId] += item.Weight * item.Quantity; } else { dictShippingMode.Add(item.TemplateId, item.Weight * item.Quantity); } } } } foreach (var item in dictShippingMode) { ShippingModeInfo shippingMode = ShoppingProcessor.GetShippingMode(item.Key); freight += ShoppingProcessor.CalcFreight(RegionId, item.Value, shippingMode); } return(freight); }
/// <summary> /// 计算重量 /// </summary> /// <param name="context"></param> void CalculateFreight(HttpContext context) { decimal freight = 0M; if (!string.IsNullOrEmpty(context.Request.Params["ModeId"]) && !string.IsNullOrEmpty(context.Request["RegionId"])) { int modeId = int.Parse(context.Request["ModeId"], NumberStyles.None); int totalWeight = int.Parse(context.Request["Weight"], NumberStyles.None); int regionId = int.Parse(context.Request["RegionId"], NumberStyles.None); ShippingModeInfo shippingMode = ShoppingProcessor.GetShippingMode(modeId, true); freight = ShoppingProcessor.CalcFreight(regionId, totalWeight, shippingMode); } StringBuilder builder = new StringBuilder(); builder.Append("{"); builder.Append("\"Status\":\"OK\","); builder.AppendFormat("\"Price\":\"{0}\", \"Price_v\":\"{1}\"", Globals.FormatMoney(freight), freight); builder.Append("}"); context.Response.ContentType = "text/plain"; context.Response.Write(builder.ToString()); }
protected override void CreateChildControls() { this.Controls.Clear(); IList <OrderLookupItemInfo> orderLookupItems = ShoppingProcessor.GetOrderLookupItems(this.LookupListId); if ((orderLookupItems != null) && (orderLookupItems.Count != 0)) { if (this.SelectMode == SelectModeTypes.DropDownList) { this.listItems = new DropDownList(); this.listItems.Items.Add(new ListItem(string.Empty, string.Empty)); this.listItems.Attributes.Add("onchange", "$.myfn.OrderOptionSelectForDropDownList(this);"); } else { this.listItems = new RadioButtonList(); } foreach (OrderLookupItemInfo info in orderLookupItems) { string str; if (info.AppendMoney.HasValue) { decimal money = this.CalculateOrderOptionPrice(info); str = this.Page.Server.HtmlDecode(info.Name) + "(" + Globals.FormatMoney(money).ToString() + ")"; } else { str = this.Page.Server.HtmlDecode(info.Name); } this.listItems.Items.Add(new ListItem(Globals.HtmlDecode(str), info.LookupItemId.ToString())); } this.Controls.Add(this.listItems); } }
protected override void AttachChildControls() { this.orderId = this.Page.Request.QueryString["orderId"]; this.litShipTo = (Literal)this.FindControl("litShipTo"); this.litPhone = (Literal)this.FindControl("litPhone"); this.litAddress = (Literal)this.FindControl("litAddress"); this.litOrderId = (Literal)this.FindControl("litOrderId"); this.litOrderDate = (Literal)this.FindControl("litOrderDate"); this.litOrderStatus = (OrderStatusLabel)this.FindControl("litOrderStatus"); this.rptOrderProducts = (VshopTemplatedRepeater)this.FindControl("rptOrderProducts"); this.litTotalPrice = (Literal)this.FindControl("litTotalPrice"); this.litPayTime = (Literal)this.FindControl("litPayTime"); this.hlinkGetRedPager = (HyperLink)this.FindControl("hlinkGetRedPager"); this.orderStatus = (HtmlInputHidden)this.FindControl("orderStatus"); this.txtOrderId = (HtmlInputHidden)this.FindControl("txtOrderId"); this.litRemark = (Literal)this.FindControl("litRemark"); this.litShipToDate = (Literal)this.FindControl("litShipToDate"); this.litShippingCost = (Literal)this.FindControl("litShippingCost"); this.litCounponPrice = (Literal)this.FindControl("litCounponPrice"); this.litRedPagerAmount = (Literal)this.FindControl("litRedPagerAmount"); this.litExemption = (Literal)this.FindControl("litExemption"); this.litBuildPrice = (Literal)this.FindControl("litBuildPrice"); this.litDisCountPrice = (Literal)this.FindControl("litDisCountPrice"); this.litActualPrice = (Literal)this.FindControl("litActualPrice"); OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(this.orderId); if (orderInfo == null) { base.GotoResourceNotFound("此订单已不存在"); } this.litShipTo.Text = orderInfo.ShipTo; this.litPhone.Text = orderInfo.CellPhone; this.litAddress.Text = orderInfo.ShippingRegion + orderInfo.Address; this.litOrderId.Text = this.orderId; this.litOrderDate.Text = orderInfo.OrderDate.ToString(); this.litTotalPrice.SetWhenIsNotNull(orderInfo.GetAmount().ToString("F2")); this.litOrderStatus.OrderStatusCode = orderInfo.OrderStatus; this.litPayTime.SetWhenIsNotNull(orderInfo.PayDate.HasValue ? orderInfo.PayDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""); OrderRedPagerInfo orderRedPagerInfo = OrderRedPagerBrower.GetOrderRedPagerInfo(this.orderId); if ((orderRedPagerInfo != null) && (orderRedPagerInfo.MaxGetTimes > orderRedPagerInfo.AlreadyGetTimes)) { this.hlinkGetRedPager.NavigateUrl = "/vshop/GetRedShare.aspx?orderid=" + this.orderId; this.hlinkGetRedPager.Visible = true; } this.orderStatus.SetWhenIsNotNull(((int)orderInfo.OrderStatus).ToString()); this.txtOrderId.SetWhenIsNotNull(this.orderId.ToString()); this.litCounponPrice.SetWhenIsNotNull(orderInfo.CouponValue.ToString("F2")); this.litRedPagerAmount.SetWhenIsNotNull(orderInfo.RedPagerAmount.ToString("F2")); this.litShippingCost.SetWhenIsNotNull(orderInfo.AdjustedFreight.ToString("F2")); this.litShipToDate.SetWhenIsNotNull(orderInfo.ShipToDate); this.litBuildPrice.SetWhenIsNotNull(orderInfo.GetAmount().ToString("F2")); this.litDisCountPrice.SetWhenIsNotNull(orderInfo.GetAdjustCommssion().ToString("F2")); this.litActualPrice.SetWhenIsNotNull(orderInfo.TotalPrice.ToString("F2")); this.litRemark.SetWhenIsNotNull(orderInfo.Remark); this.litExemption.SetWhenIsNotNull(orderInfo.DiscountAmount.ToString("F2")); this.rptOrderProducts.DataSource = orderInfo.LineItems.Values; this.rptOrderProducts.DataBind(); PageTitle.AddSiteNameTitle("订单详情"); }
private void ProcessUnUpsellingSku(HttpContext context) { context.Response.ContentType = "application/json"; int productId = int.Parse(context.Request["productId"], NumberStyles.None); int attributeId = int.Parse(context.Request["AttributeId"], NumberStyles.None); int valueId = int.Parse(context.Request["ValueId"], NumberStyles.None); DataTable table = ShoppingProcessor.GetUnUpUnUpsellingSkus(productId, attributeId, valueId); if ((table == null) || (table.Rows.Count == 0)) { context.Response.Write("{\"Status\":\"1\"}"); } else { StringBuilder builder = new StringBuilder(); builder.Append("{"); builder.Append("\"Status\":\"OK\","); builder.Append("\"SkuItems\":["); foreach (DataRow row in table.Rows) { builder.Append("{"); builder.AppendFormat("\"AttributeId\":\"{0}\",", row["AttributeId"].ToString()); builder.AppendFormat("\"ValueId\":\"{0}\"", row["ValueId"].ToString()); builder.Append("},"); } builder.Remove(builder.Length - 1, 1); builder.Append("]"); builder.Append("}"); context.Response.Write(builder.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { string value = this.PostInput(); JObject jObject = JsonConvert.DeserializeObject(value) as JObject; string orderId = jObject["order_id"].ToNullString(); int num = jObject["order_status"].ToInt(0); OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(orderId); if (orderInfo != null && num != 0) { if (num == 5) { orderInfo.OrderStatus = OrderStatus.BuyerAlreadyPaid; orderInfo.CloseReason = jObject["cancel_reason"].ToNullString(); } if (num == 2) { orderInfo.OrderStatus = OrderStatus.SellerAlreadySent; orderInfo.ShipOrderNumber = jObject["client_id"].ToNullString(); } if (num == 4) { orderInfo.OrderStatus = OrderStatus.Finished; orderInfo.FinishDate = DateTime.Now; } orderInfo.DadaStatus = (DadaStatus)num; TradeHelper.UpdateOrderInfo(orderInfo); } }
private void btnSubMitOrder_Click(object sender, System.EventArgs e) { OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(this.orderId); if (DateTime.Now < DateTime.Parse("2015-08-21")) { //判断该用户是否有参与首单的活动 int result = ShoppingProcessor.CheckIsFirstOrder(HiContext.Current.User.UserId, (int)OrderSource.PC); if (result > 0 && orderInfo.ActivityType == 1) { //this.ShowMessage("该用户已经参加过首单活动", false); return; } } if (orderInfo != null) { if (orderInfo.Gateway != "ecdev.plugins.payment.advancerequest") { System.Web.HttpContext.Current.Response.Redirect(Globals.GetSiteUrls().UrlData.FormatUrl("sendPayment", new object[] { this.orderId })); return; } System.Web.HttpContext.Current.Response.Redirect(string.Format("/user/pay.aspx?OrderId={0}", this.orderId)); } }
protected override void AttachChildControls() { PageTitle.AddSiteNameTitle("余额充值"); this.litPaymentType = (Literal)this.FindControl("litPaymentType"); IList <PaymentModeInfo> paymentModes = ShoppingProcessor.GetPaymentModes(); SiteSettings masterSettings = SettingsManager.GetMasterSettings(true); StringBuilder builder = new StringBuilder(); string userAgent = this.Page.Request.UserAgent; if ((masterSettings.EnableWeiXinRequest && userAgent.ToLower().Contains("micromessenger")) && masterSettings.IsValidationService) { builder.AppendLine("<div class=\"payway\" name=\"88\">微信支付</div>"); } if ((paymentModes != null) && (paymentModes.Count > 0)) { foreach (PaymentModeInfo info in paymentModes) { string xml = HiCryptographer.Decrypt(info.Settings); XmlDocument document = new XmlDocument(); document.LoadXml(xml); if (document.GetElementsByTagName("Partner").Count != 0) { if ((masterSettings.EnableAlipayRequest && !string.IsNullOrEmpty(document.GetElementsByTagName("Partner")[0].InnerText)) && (!string.IsNullOrEmpty(document.GetElementsByTagName("Key")[0].InnerText) && !string.IsNullOrEmpty(document.GetElementsByTagName("Seller_account_name")[0].InnerText))) { builder.AppendFormat("<div class=\"payway\" name=\"{0}\">{1}</div>", info.ModeId, info.Name).AppendLine(); } } else if ((masterSettings.EnableWapShengPay && !string.IsNullOrEmpty(document.GetElementsByTagName("SenderId")[0].InnerText)) && !string.IsNullOrEmpty(document.GetElementsByTagName("SellerKey")[0].InnerText)) { builder.AppendFormat("<div class=\"payway\" name=\"{0}\">{1}</div>", info.ModeId, info.Name).AppendLine(); } } } this.litPaymentType.Text = builder.ToString(); }
private void SearchExpressData(HttpContext context) { string s = "{"; if (!string.IsNullOrEmpty(context.Request["OrderId"])) { string orderId = context.Request["OrderId"]; OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(orderId); if (((orderInfo != null) && ((orderInfo.OrderStatus == OrderStatus.SellerAlreadySent) || (orderInfo.OrderStatus == OrderStatus.Finished))) && !string.IsNullOrEmpty(orderInfo.ExpressCompanyAbb)) { string expressData = Express.GetExpressData(orderInfo.ExpressCompanyAbb, orderInfo.ShipOrderNumber); s = s + "\"Express\":\"" + expressData + "\""; } } else if (!string.IsNullOrEmpty(context.Request["PurchaseOrderId"])) { string purchaseOrderId = context.Request["PurchaseOrderId"]; PurchaseOrderInfo purchaseOrder = ShoppingProcessor.GetPurchaseOrder(purchaseOrderId); if (((purchaseOrder != null) && ((purchaseOrder.PurchaseStatus == OrderStatus.SellerAlreadySent) || (purchaseOrder.PurchaseStatus == OrderStatus.Finished))) && !string.IsNullOrEmpty(purchaseOrder.ExpressCompanyAbb)) { string str5 = Express.GetExpressData(purchaseOrder.ExpressCompanyAbb, purchaseOrder.ShipOrderNumber); s = s + "\"Express\":\"" + str5 + "\""; } } s = s + "}"; context.Response.ContentType = "text/plain"; context.Response.Write(s); context.Response.End(); }
protected override void Render(HtmlTextWriter writer) { DataTable coupon = ShoppingProcessor.GetCoupon(this.CartTotal); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("<button type=\"button\" class=\"btn btn-default dropdown-toggle\" data-toggle=\"dropdown\">请选择一张优惠券<span class=\"caret\"></span></button>"); stringBuilder.AppendLine("<ul class=\"dropdown-menu\" role=\"menu\">"); stringBuilder.AppendLine("<li><a href='#' name='' value='0.00'>请选择一张优惠券</a></li>"); foreach (DataRow dataRow in coupon.Rows) { string fmType = "<li><a href=\"#\" name=\"{0}\" value=\"{3}\">{1}(满{2}减{3})</a></li>"; if (dataRow["SendType"].ToString() == "4") { fmType = "<li><a href=\"#\" name=\"{0}\" value=\"{3}\">{1}(¥{3})</a></li>"; } stringBuilder.AppendFormat(fmType, new object[] { dataRow["ClaimCode"], dataRow["Name"], ((decimal)dataRow["Amount"]).ToString("F2"), ((decimal)dataRow["DiscountValue"]).ToString("F2") }).AppendLine(); } stringBuilder.AppendLine("</ul>"); writer.Write(stringBuilder.ToString()); }
protected void Page_Load(object sender, System.EventArgs e) { base.Response.Write("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no\"/>"); System.Collections.Generic.SortedDictionary <string, string> requestGet = this.GetRequestGet(); if (requestGet.Count <= 0) { base.Response.Write("<p style=\"font-size:16px;\">参数为空,支付异常!</p>"); return; } Notify notify = new Notify(); bool flag = notify.Verify(requestGet, base.Request.QueryString["notify_id"], base.Request.QueryString["sign"]); if (!flag) { base.Response.Write("<p style=\"font-size:16px;\">签名验证失败,可能支付密钥已经被修改</p>"); return; } this.OrderId = base.Request.QueryString["out_trade_no"]; string arg_91_0 = base.Request.QueryString["trade_no"]; string arg_A7_0 = base.Request.QueryString["trade_status"]; System.Collections.Generic.List <OrderInfo> orderMarkingOrderInfo = ShoppingProcessor.GetOrderMarkingOrderInfo(this.OrderId, true); if (orderMarkingOrderInfo.Count == 0) { base.Response.Write("<p style=\"font-size:16px;\">找不到对应的订单,你付款的订单可能已经被删除</p>"); return; } if (base.Request.QueryString["trade_status"] == "TRADE_FINISHED" || base.Request.QueryString["trade_status"] == "TRADE_SUCCESS") { this.Amount = decimal.Parse(base.Request.QueryString["total_fee"]); this.UserPayOrder(); return; } base.Response.Write(string.Format("<p style=\"font-size:16px;color:#ff0000;\">支付失败,<br><a href=\"{0}\">查看订单</a></p>", "Vshop/MemberOrders.aspx?Status=3")); }
protected override void AttachChildControls() { if (!this.OnlyShowInDefault) { this.dropRegions = (RegionSelector)this.FindControl("dropRegions"); this.CurrentRegion = (Literal)this.FindControl("litCurrentRegion"); this.labProductFreight = (HtmlGenericControl)this.FindControl("labProductFreight"); int deliveryScopRegionId = HiContext.Current.DeliveryScopRegionId; if (deliveryScopRegionId != 0) { this.dropRegions.SetSelectedRegionId(deliveryScopRegionId); this.CurrentRegion.Text = RegionHelper.GetFullRegion(deliveryScopRegionId, " ", true, 0); } else { this.CurrentRegion.Text = "请选择配送区域"; } if (this.labProductFreight != null) { decimal num = ShoppingProcessor.CalcProductFreight(deliveryScopRegionId, this.ShippingTemplateId, this.Volume, this.Weight, 1, decimal.Zero); if (num > decimal.Zero) { this.labProductFreight.InnerHtml = "运费:<label>" + num.F2ToString("f2") + "</label>"; } else { this.labProductFreight.InnerHtml = "免运费"; } } } }
protected override void AttachChildControls() { this.spanvcodecount = (HtmlGenericControl)this.FindControl("spanvcodecount"); this.spanvcodetime = (HtmlGenericControl)this.FindControl("spanvcodetime"); this.rptVCodes = (Repeater)this.FindControl("rptVCodes"); this.orderId = this.Page.Request.QueryString["orderId"]; this.order = ShoppingProcessor.GetOrderInfo(this.orderId); if (this.order == null || this.order.UserId != HiContext.Current.UserId || this.order.OrderType != OrderType.ServiceOrder) { base.GotoResourceNotFound("此订单已不存在"); } IList <OrderVerificationItemInfo> orderVerificationItems = TradeHelper.GetOrderVerificationItems(this.orderId); this.CreateVerificationCodeQRCode(orderVerificationItems); LineItemInfo value = this.order.LineItems.FirstOrDefault().Value; this.spanvcodecount.InnerHtml = orderVerificationItems.Count().ToString(); string innerHtml = "长期有效"; if (!value.IsValid && value.ValidStartDate.HasValue && value.ValidEndDate.HasValue) { DateTime value2 = value.ValidStartDate.Value; string str = value2.ToString("yyyy-MM-dd"); value2 = value.ValidEndDate.Value; innerHtml = str + " 至 " + value2.ToString("yyyy-MM-dd"); } this.spanvcodetime.InnerHtml = innerHtml; this.rptVCodes.ItemDataBound += this.rptVCodes_ItemDataBound; this.rptVCodes.DataSource = orderVerificationItems; this.rptVCodes.DataBind(); }
private void SearchOrder() { string text = "[{"; string orderId = this.Page.Request["OrderId"]; OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(orderId); if (orderInfo != null) { string text2 = text; text = string.Concat(new string[] { text2, "\"OrderId\":\"", orderInfo.OrderId, "\",\"ShippingStatus\":\"", OrderInfo.GetOrderStatusName(orderInfo.OrderStatus, orderInfo.SourceOrderId), "\",\"ShipOrderNumber\":\"", orderInfo.ShipOrderNumber, "\",\"ShipModeName\":\"", orderInfo.RealModeName, "\"" }); } text += "}]"; this.Page.Response.ContentType = "text/plain"; this.Page.Response.Write(text); this.Page.Response.End(); }
private void dataSupplier_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem) { return; } Repeater repeater = e.Item.FindControl("dataListShoppingCrat") as Repeater; Label label = e.Item.FindControl("lblSupplierAmount") as Label; Label label2 = e.Item.FindControl("lblFreight") as Label; if (repeater != null) { repeater.ItemDataBound += this.dataListShoppingCart_ItemDataBound; object dataItem = e.Item.DataItem; Type type = dataItem.GetType(); PropertyInfo property = type.GetProperty("SupplierId", typeof(int)); int sid = int.Parse(property.GetValue(dataItem, null).ToString()); List <ShoppingCartItemInfo> dataSource = (from i in this.ShoppingCart.LineItems where i.SupplierId == sid select i).ToList(); decimal num = (from i in this.ShoppingCart.LineItems where i.SupplierId == sid select i.AdjustedPrice.F2ToString("f2").ToDecimal(0) * (decimal)i.Quantity).Sum(); repeater.DataSource = dataSource; repeater.DataBind(); label.Text = "¥" + num.F2ToString("f2"); decimal num2 = ShoppingProcessor.CalcSupplierFreight(sid, 0, this.ShoppingCart); label2.Text = "¥" + num2.F2ToString("f2") + ((sid == 0 && this.ShoppingCart.LineGifts.Count() > 0) ? "(含礼品)" : ""); label2.CssClass = "spanFreight" + sid; } }
private void ProcessGetSkuByOptions(System.Web.HttpContext context) { context.Response.ContentType = "application/json"; int productId = int.Parse(context.Request["productId"], System.Globalization.NumberStyles.None); string text = context.Request["options"]; if (string.IsNullOrEmpty(text)) { context.Response.Write("{\"Status\":\"0\"}"); return; } if (text.EndsWith(",")) { text = text.Substring(0, text.Length - 1); } SKUItem productAndSku = ShoppingProcessor.GetProductAndSku(productId, text); if (productAndSku == null) { context.Response.Write("{\"Status\":\"1\"}"); return; } System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); stringBuilder.Append("{"); stringBuilder.Append("\"Status\":\"OK\","); stringBuilder.AppendFormat("\"SkuId\":\"{0}\",", productAndSku.SkuId); stringBuilder.AppendFormat("\"SKU\":\"{0}\",", productAndSku.SKU); stringBuilder.AppendFormat("\"Weight\":\"{0}\",", productAndSku.Weight.ToString("F2")); stringBuilder.AppendFormat("\"Stock\":\"{0}\",", productAndSku.Stock); stringBuilder.AppendFormat("\"SalePrice\":\"{0}\"", productAndSku.SalePrice.ToString("F2")); stringBuilder.Append("}"); context.Response.ContentType = "application/json"; context.Response.Write(stringBuilder.ToString()); }
protected override void AttachChildControls() { PageTitle.AddSiteNameTitle("交易密码"); HtmlInputHidden htmlInputHidden = (HtmlInputHidden)this.FindControl("hidkey"); Literal literal = (Literal)this.FindControl("OrderId"); Literal literal2 = (Literal)this.FindControl("litOrderTotal"); string orderId = literal.Text = this.Page.Request.QueryString["orderId"].ToNullString(); OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(orderId); string str = ""; if (orderInfo == null || !TradeHelper.CheckOrderStockBeforePay(orderInfo, out str)) { base.GotoResourceNotFound(str + ",库存不足,不能进行支付"); } else { HtmlInputHidden htmlInputHidden2 = (HtmlInputHidden)this.FindControl("txtIsFightGroup"); if (htmlInputHidden2 != null) { htmlInputHidden2.Value = ((orderInfo.FightGroupId > 0) ? "true" : "false"); } decimal num = default(decimal); if (decimal.TryParse(this.Page.Request.QueryString["totalAmount"], out num)) { literal2.Text = num.F2ToString("f2"); } else { base.GotoResourceNotFound("传入值有误"); } } }
void ProcessAddToCartBySkus(HttpContext context) { context.Response.ContentType = "application/json"; int quantity = int.Parse(context.Request["quantity"], NumberStyles.None); string skuId = context.Request["productSkuId"]; DataTable productInfoBySku = ShoppingProcessor.GetProductInfoBySku(skuId); if ((productInfoBySku == null) || (productInfoBySku.Rows.Count <= 0)) { context.Response.Write("{\"Status\":\"0\"}"); } else if ((((int)productInfoBySku.Rows[0]["Stock"]) <= 0) || (((int)productInfoBySku.Rows[0]["Stock"]) < quantity)) { context.Response.Write("{\"Status\":\"1\"}"); } else { string skuContent = string.Empty; foreach (DataRow row in productInfoBySku.Rows) { if (((row["AttributeName"] != DBNull.Value) && !string.IsNullOrEmpty((string)row["AttributeName"])) && ((row["ValueStr"] != DBNull.Value) && !string.IsNullOrEmpty((string)row["ValueStr"]))) { object obj2 = skuContent; skuContent = string.Concat(new object[] { obj2, row["AttributeName"], ":", row["ValueStr"], "; " }); } } ShoppingCartProcessor.AddLineItem((int)productInfoBySku.Rows[0]["ProductId"], skuId, skuContent, quantity); ShoppingCartInfo shoppingCart = ShoppingCartProcessor.GetShoppingCart(); context.Response.Write("{\"Status\":\"OK\",\"TotalMoney\":\"" + shoppingCart.GetTotal().ToString(".00") + "\",\"Quantity\":\"" + shoppingCart.Quantity.ToString() + "\"}"); } }
protected override void Render(HtmlTextWriter writer) { string text = string.Empty; OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(this.orderId); if (orderInfo != null) { bool arg_3A_0; if (orderInfo.OrderStatus != OrderStatus.SellerAlreadySent) { if (orderInfo.OrderStatus != OrderStatus.Finished) { arg_3A_0 = true; goto IL_3A; } } arg_3A_0 = string.IsNullOrEmpty(orderInfo.ExpressCompanyAbb); IL_3A: if (!arg_3A_0) { string expressData = Express.GetExpressData(orderInfo.ExpressCompanyAbb, orderInfo.ShipOrderNumber); text += expressData; } } writer.Write(text); }
protected void btnSKU_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.txtSKU.Text.Trim())) { this.ShowMessage("请输入货号", false, "", 1); } else { IList <string> skuIdsBysku = ShoppingProcessor.GetSkuIdsBysku(this.txtSKU.Text.Trim()); if (skuIdsBysku == null || skuIdsBysku.Count == 0) { this.ShowMessage("货号无效,请确认后重试", false, "", 1); } else { bool flag = false; foreach (string item in skuIdsBysku) { if (ShoppingCartProcessor.GetSkuStock(item, 0) > 1) { ShoppingCartProcessor.AddLineItem(item, 1, false, 0); } else { flag = true; } } if (flag) { this.ShowMessage("指定的货号库存不足", false, "", 1); } this.BindShoppingCart(); } } }
void FillOrderShippingMode(OrderInfo orderInfo, ShoppingCartInfo shoppingCartInfo) { orderInfo.ShippingRegion = dropRegions.SelectedRegions; orderInfo.Address = Globals.HtmlEncode(txtAddress.Text); orderInfo.ZipCode = txtZipcode.Text; orderInfo.ShipTo = Globals.HtmlEncode(txtShipTo.Text); orderInfo.TelPhone = txtTelPhone.Text; orderInfo.CellPhone = txtCellPhone.Text; if (!string.IsNullOrEmpty(inputShippingModeId.Value)) { orderInfo.ShippingModeId = int.Parse(inputShippingModeId.Value, NumberStyles.None); } if (dropRegions.GetSelectedRegionId().HasValue) { orderInfo.RegionId = dropRegions.GetSelectedRegionId().Value; } ShippingModeInfo shippingMode = ShoppingProcessor.GetShippingMode(orderInfo.ShippingModeId, true); if (shippingMode != null) { orderInfo.ModeName = shippingMode.Name; orderInfo.Freight = ShoppingProcessor.CalcFreight(orderInfo.RegionId, shoppingCartInfo.Weight, shippingMode); orderInfo.AdjustedFreight = orderInfo.Freight; } }
void ReBindPayment() { IList <PaymentModeInfo> paymentModes = ShoppingProcessor.GetPaymentModes(); IList <PaymentModeInfo> list2 = new List <PaymentModeInfo>(); HttpCookie cookie = HiContext.Current.Context.Request.Cookies["Token_" + HiContext.Current.User.UserId.ToString()]; if ((cookie != null) && !string.IsNullOrEmpty(cookie.Value)) { foreach (PaymentModeInfo info in paymentModes) { if ((((string.Compare(info.Gateway, "hishop.plugins.payment.alipay_shortcut.shortcutrequest", true) == 0) || (string.Compare(info.Gateway, "hishop.plugins.payment.alipaydirect.directrequest", true) == 0)) || ((string.Compare(info.Gateway, "hishop.plugins.payment.alipayassure.assurerequest", true) == 0) || (string.Compare(info.Gateway, "hishop.plugins.payment.alipay.standardrequest", true) == 0))) || ((string.Compare(info.Gateway, "hishop.plugins.payment.advancerequest", true) != 0) || !HiContext.Current.User.IsAnonymous)) { list2.Add(info); } } } else { foreach (PaymentModeInfo info2 in paymentModes) { if (string.Compare(info2.Gateway, "hishop.plugins.payment.alipay_shortcut.shortcutrequest", true) != 0) { list2.Add(info2); } if ((string.Compare(info2.Gateway, "hishop.plugins.payment.advancerequest", true) == 0) && HiContext.Current.User.IsAnonymous) { list2.Remove(info2); } } } paymentModeList.DataSource = list2; paymentModeList.DataBind(); }
protected override void Render(HtmlTextWriter writer) { IList <PaymentModeInfo> paymentModes = ShoppingProcessor.GetPaymentModes(); StringBuilder builder = new StringBuilder(); if (Hidistro.ControlPanel.Config.CustomConfigHelper.Instance.IsProLa) { builder.Append("<button class=\"choose\" data-toggle=\"dropdown\">请选择一种支付方式<span class=\"caret\"></span></button>"); } else { builder.Append("<button type=\"button\" class=\"btn btn-default dropdown-toggle\" data-toggle=\"dropdown\">请选择一种支付方式<span class=\"caret\"></span></button>"); } builder.AppendLine("<ul id=\"selectPaymentType\" class=\"dropdown-menu\" role=\"menu\">"); if (MemberProcessor.GetCurrentMember().RegSource == 0) { if (SettingsManager.GetMasterSettings(false).EnableWeiXinRequest) { builder.AppendLine("<li><a href=\"#\" name=\"88\">微信支付</a></li>"); } if (SettingsManager.GetMasterSettings(false).EnableOffLineRequest) { builder.AppendLine("<li><a href=\"#\" name=\"99\">线下付款</a></li>"); } if (SettingsManager.GetMasterSettings(false).EnablePodRequest) { builder.AppendLine("<li><a href=\"#\" name=\"0\">货到付款</a></li>"); } if ((paymentModes != null) && (paymentModes.Count > 0)) { foreach (PaymentModeInfo info in paymentModes) { string xml = HiCryptographer.Decrypt(info.Settings); XmlDocument document = new XmlDocument(); document.LoadXml(xml); if (document.GetElementsByTagName("Partner").Count != 0) { if ((!string.IsNullOrEmpty(document.GetElementsByTagName("Partner")[0].InnerText) && !string.IsNullOrEmpty(document.GetElementsByTagName("Key")[0].InnerText)))// && !string.IsNullOrEmpty(document.GetElementsByTagName("Seller_account_name")[0].InnerText) { builder.AppendFormat("<li><a href=\"#\" name=\"{0}\">{1}</a></li>", info.ModeId, info.Name).AppendLine(); } } else if ((SettingsManager.GetMasterSettings(false).EnableWapShengPay&& !string.IsNullOrEmpty(document.GetElementsByTagName("SenderId")[0].InnerText)) && !string.IsNullOrEmpty(document.GetElementsByTagName("SellerKey")[0].InnerText)) { builder.AppendFormat("<li><a href=\"#\" name=\"{0}\">{1}</a></li>", info.ModeId, info.Name).AppendLine(); } } } builder.AppendLine("</ul>"); writer.Write(builder.ToString()); } else { builder.AppendLine("</ul>"); writer.Write(builder.ToString()); } }