private void AjaxAction(string action) { string s = "{\"state\":false,\"msg\":\"未定义操作\"}"; NameValueCollection form = base.Request.Form; string str2 = action; if (str2 != null) { if (!(str2 == "edit")) { if (str2 == "save") { try { OneyuanTaoInfo info2 = new OneyuanTaoInfo { IsOn = true, IsEnd = false, PrizeNumber = int.Parse(form["PrizeNumber"]), ActivityDec = form["ActivityDec"], Title = form["Title"], StartTime = DateTime.Parse(form["StartTime"]), EndTime = DateTime.Parse(form["EndTime"]), EachPrice = decimal.Parse(form["EachPrice"]), ReachNum = int.Parse(form["ReachNum"]), EachCanBuyNum = int.Parse(form["EachCanBuyNum"]), FitMember = form["FitMember"], DefualtGroup = form["DefualtGroup"], CustomGroup = form["CustomGroup"], FinishedNum = 0, SkuId = "N", ProductImg = form["ProductImg"], ProductId = int.Parse(form["ProductId"]), HeadImgage = form["HeadImgage"], ReachType = int.Parse(form["ReachType"]), ProductPrice = decimal.Parse(form["ProductPrice"]), ProductTitle = form["ProductTitle"] }; if (info2.ActivityDec.Length > 100) { s = "{\"state\":false,\"msg\":\"活动描述信息太长!\"}"; } else if (OneyuanTaoHelp.AddOneyuanTao(info2)) { s = "{\"state\":true,\"msg\":\"保存活动成功\"}"; } else { s = "{\"state\":false,\"msg\":\"保存活动失败\"}"; } } catch (Exception exception) { s = "{\"state\":false,\"msg\":\"" + exception.Message.Replace("'", " ").Replace("\r\n", " ") + "\"}"; } } else if (str2 == "read") { s = "{\"state\":false,\"msg\":\"读取数据\"}"; } } else { OneyuanTaoInfo oneyuanTaoInfoById = OneyuanTaoHelp.GetOneyuanTaoInfoById(form["ActivityId"]); if (oneyuanTaoInfoById != null) { this.OneTaoState = OneyuanTaoHelp.getOneTaoState(oneyuanTaoInfoById); if (this.OneTaoState == Hidistro.SaleSystem.Vshop.OneTaoState.已结束) { s = "{\"state\":false,\"msg\":\"当前活动已结束,不能再修改!\"}"; } else { oneyuanTaoInfoById.ActivityDec = form["ActivityDec"]; oneyuanTaoInfoById.Title = form["Title"]; oneyuanTaoInfoById.FitMember = form["FitMember"]; oneyuanTaoInfoById.DefualtGroup = form["DefualtGroup"]; oneyuanTaoInfoById.CustomGroup = form["CustomGroup"]; oneyuanTaoInfoById.HeadImgage = form["HeadImgage"]; if (this.OneTaoState == Hidistro.SaleSystem.Vshop.OneTaoState.未开始) { oneyuanTaoInfoById.ProductId = int.Parse(form["ProductId"]); oneyuanTaoInfoById.StartTime = DateTime.Parse(form["StartTime"]); oneyuanTaoInfoById.EndTime = DateTime.Parse(form["EndTime"]); oneyuanTaoInfoById.EachPrice = decimal.Parse(form["EachPrice"]); oneyuanTaoInfoById.ReachNum = int.Parse(form["ReachNum"]); oneyuanTaoInfoById.EachCanBuyNum = int.Parse(form["EachCanBuyNum"]); oneyuanTaoInfoById.PrizeNumber = int.Parse(form["PrizeNumber"]); oneyuanTaoInfoById.ReachType = int.Parse(form["ReachType"]); oneyuanTaoInfoById.ProductPrice = decimal.Parse(form["ProductPrice"]); oneyuanTaoInfoById.ProductTitle = form["ProductTitle"]; oneyuanTaoInfoById.FinishedNum = 0; oneyuanTaoInfoById.SkuId = "N"; oneyuanTaoInfoById.ProductImg = form["ProductImg"]; } if (oneyuanTaoInfoById.ActivityDec.Length > 100) { s = "{\"state\":false,\"msg\":\"活动描述信息太长!\"}"; } else if (OneyuanTaoHelp.UpdateOneyuanTao(oneyuanTaoInfoById)) { s = "{\"state\":true,\"msg\":\"活动修改成功!\"}"; } else { s = "{\"state\":false,\"msg\":\"修改失败!\"}"; } } } else { s = "{\"state\":false,\"msg\":\"活动信息不存在,可能已删除!\"}"; } } } base.Response.ClearContent(); base.Response.ContentType = "application/json"; base.Response.Write(s); base.Response.End(); }
private void DoOneTaoPay(string Pid) { if (string.IsNullOrEmpty(Pid)) { base.Response.Write("支付参数不正确!<a href='javascript:history.go(-1);'>返回上一页</a>"); base.Response.End(); } OneyuanTaoParticipantInfo addParticipant = OneyuanTaoHelp.GetAddParticipant(0, Pid, ""); if (addParticipant == null) { base.Response.Write("您的夺宝信息已被删除!<a href='javascript:history.go(-1);'>返回上一页</a>"); base.Response.End(); } string activityId = addParticipant.ActivityId; OneyuanTaoInfo oneyuanTaoInfoById = OneyuanTaoHelp.GetOneyuanTaoInfoById(activityId); if (oneyuanTaoInfoById == null) { base.Response.Write("夺宝活动已被删除,你无法完成支付!<a href='javascript:history.go(-1);'>返回上一页</a>"); base.Response.End(); } OneTaoState oneTaoState = OneyuanTaoHelp.getOneTaoState(oneyuanTaoInfoById); if (oneTaoState != OneTaoState.进行中) { base.Response.Write("当前活动" + oneTaoState.ToString() + ",无法支付!<a href='javascript:history.go(-1);'>返回上一页</a>"); base.Response.End(); } if (oneyuanTaoInfoById.FinishedNum + addParticipant.BuyNum > oneyuanTaoInfoById.ReachNum) { base.Response.Write("活动已满员,您可以试下其它活动!<a href='/Vshop/OneyuanList.aspx'>夺宝活动中心</a>"); base.Response.End(); } SiteSettings masterSettings = SettingsManager.GetMasterSettings(true); string alipay_Pid = masterSettings.Alipay_Pid; string alipay_Key = masterSettings.Alipay_Key; string text = "utf-8"; Hidistro.ControlPanel.OutPay.App.Core.setConfig(alipay_Pid, "MD5", alipay_Key, text); string value = "1"; string value2 = Globals.FullPath("/Vshop/OneTaoPaySuccess.aspx"); string value3 = Globals.FullPath("/Pay/wap_alipay_notify_url.aspx"); string value4 = "订单支付"; decimal totalPrice = addParticipant.TotalPrice; string value5 = Globals.FullPath("/Vshop/OneTaoPayView.aspx?Pid=") + Pid; SiteSettings masterSettings2 = SettingsManager.GetMasterSettings(false); string value6 = masterSettings2.SiteName + "支付,当前支付编号-" + Pid + " ..."; string value7 = "1m"; string value8 = ""; string s = Hidistro.ControlPanel.OutPay.App.Core.BuildRequest(new System.Collections.Generic.SortedDictionary <string, string> { { "partner", alipay_Pid }, { "seller_id", alipay_Pid }, { "_input_charset", text }, { "service", "alipay.wap.create.direct.pay.by.user" }, { "payment_type", value }, { "notify_url", value3 }, { "return_url", value2 }, { "out_trade_no", Pid }, { "subject", value4 }, { "total_fee", totalPrice.ToString("F") }, { "show_url", value5 }, { "body", value6 }, { "it_b_pay", value7 }, { "extern_token", value8 } }, "get", "确认"); base.Response.Write(s); }
private void AjaxAction(string action) { string s = "{\"state\":false,\"msg\":\"未定义操作\"}"; System.Collections.Specialized.NameValueCollection form = base.Request.Form; switch (action) { case "Del": { s = "{\"state\":false,\"msg\":\"活动信息未找到失败\"}"; string text = form["Aid"]; if (!string.IsNullOrEmpty(text)) { OneyuanTaoInfo oneyuanTaoInfoById = OneyuanTaoHelp.GetOneyuanTaoInfoById(text); if (oneyuanTaoInfoById != null) { if (OneyuanTaoHelp.DeleteOneyuanTao(text)) { s = "{\"state\":true,\"msg\":\"删除成功\"}"; OneyuanTaoHelp.DelParticipantMember(text, true); } else { s = "{\"state\":false,\"msg\":\"该活动已有人参与,不能删除!\"}"; } } } break; } case "BatchDel": { s = "{\"state\":false,\"msg\":\"批量删除失败\"}"; string text = form["Aids"]; if (!string.IsNullOrEmpty(text)) { string[] array = text.Split(new char[] { ',' }); int num2 = OneyuanTaoHelp.BatchDeleteOneyuanTao(array); if (num2 > 0) { s = string.Concat(new string[] { "{\"state\":true,\"msg\":\"成功删除", num2.ToString(), "条数据,失败", (array.Length - num2).ToString(), "条!\"}" }); string[] array2 = array; for (int i = 0; i < array2.Length; i++) { string activityId = array2[i]; OneyuanTaoHelp.DelParticipantMember(activityId, true); } } else { s = "{\"state\":false,\"msg\":\"没有找到可删除的数据!\"}"; } } break; } case "EndII": { string text = form["Aid"]; string text2 = form["CanDraw"]; if (string.IsNullOrEmpty(text) || string.IsNullOrEmpty(text2)) { s = "{\"state\":false,\"msg\":\"参数错误\"}"; } else if (text2.Trim() == "1") { string text3 = OneyuanTaoHelp.CalculateWinner(text); if (text3 == "success") { s = "{\"state\":true,\"msg\":\"手动开奖成功!\"}"; } else { s = "{\"state\":false,\"msg\":\"" + text3 + "\"}"; } } else if (OneyuanTaoHelp.SetOneyuanTaoIsOn(text, false)) { s = "{\"state\":true,\"msg\":\"提前终止活动成功!!\"}"; OneyuanTaoHelp.DelParticipantMember(text, true); } else { s = "{\"state\":false,\"msg\":\"提前终止活动失败!\"}"; } break; } case "End": { s = "{\"state\":false,\"msg\":\"结束失败\"}"; string text = form["Aid"]; if (!string.IsNullOrEmpty(text)) { OneyuanTaoInfo oneyuanTaoInfoById = OneyuanTaoHelp.GetOneyuanTaoInfoById(text); if (oneyuanTaoInfoById != null) { OneTaoState oneTaoState = this.getOneTaoState(oneyuanTaoInfoById); if (oneTaoState == OneTaoState.进行中) { if (OneyuanTaoHelp.SetOneyuanTaoIsOn(text, false)) { s = "{\"state\":true,\"msg\":\"提前终止活动成功!!\"}"; OneyuanTaoHelp.DelParticipantMember(text, true); } else { s = "{\"state\":false,\"msg\":\"提前终止活动失败!\"}"; } } else { s = "{\"state\":false,\"msg\":\"提前终止活动失败!\"}"; } } } break; } case "Start": { s = "{\"state\":false,\"msg\":\"操作开始失败\"}"; string text = form["Aid"]; if (!string.IsNullOrEmpty(text)) { OneyuanTaoInfo oneyuanTaoInfoById = OneyuanTaoHelp.GetOneyuanTaoInfoById(text); if (oneyuanTaoInfoById != null) { if (this.getOneTaoState(oneyuanTaoInfoById) == OneTaoState.未开始) { if (OneyuanTaoHelp.SetOneyuanTaoIsOn(text, true)) { s = "{\"state\":true,\"msg\":\"提前开启活动成功!!\"}"; } else { s = "{\"state\":false,\"msg\":\"当前状态不能结束!\"}"; } } else { s = "{\"state\":false,\"msg\":\"当前状态开启活动!\"}"; } } } break; } case "BatchStart": { s = "{\"state\":false,\"msg\":\"批量操作开始失败\"}"; string text = form["Aids"]; if (!string.IsNullOrEmpty(text)) { string[] array = text.Split(new char[] { ',' }); int num3 = OneyuanTaoHelp.BatchSetOneyuanTaoIsOn(array, true); if (num3 > 0) { s = string.Concat(new string[] { "{\"state\":true,\"msg\":\"成功开启", num3.ToString(), "条活动,失败", (array.Length - num3).ToString(), "条!\"}" }); } else { s = "{\"state\":false,\"msg\":\"没有找到可开启的活动数据!\"}"; } } break; } } base.Response.ClearContent(); base.Response.ContentType = "application/json"; base.Response.Write(s); base.Response.End(); }
protected void Page_Load(object sender, System.EventArgs e) { string text = base.Request.QueryString.Get("orderId"); if (string.IsNullOrEmpty(text)) { this.pay_json = "{\"msg\":\"订单参数错误!\"}"; return; } OneyuanTaoParticipantInfo addParticipant = OneyuanTaoHelp.GetAddParticipant(0, text, ""); if (addParticipant == null) { this.pay_json = "{\"msg\":\"订单不存在了!\"}"; return; } OneyuanTaoInfo oneyuanTaoInfoById = OneyuanTaoHelp.GetOneyuanTaoInfoById(addParticipant.ActivityId); if (oneyuanTaoInfoById == null) { this.pay_json = "{\"msg\":\"活动已取消,禁止参与!\"}"; return; } OneTaoState oneTaoState = OneyuanTaoHelp.getOneTaoState(oneyuanTaoInfoById); if (oneTaoState != OneTaoState.进行中) { this.pay_json = "{\"msg\":\"您来晚了,活动已结束!\"}"; return; } if (oneTaoState != OneTaoState.进行中) { this.pay_json = "{\"msg\":\"您来晚了,活动已结束!\"}"; return; } if (oneyuanTaoInfoById.ReachType == 1 && oneyuanTaoInfoById.FinishedNum + addParticipant.BuyNum > oneyuanTaoInfoById.ReachNum) { this.pay_json = "{\"msg\":\"活动已满员,您来晚了!\"}"; return; } decimal totalPrice = addParticipant.TotalPrice; PackageInfo packageInfo = new PackageInfo(); packageInfo.Body = Globals.SubStr(oneyuanTaoInfoById.ProductTitle, 36, "...") + "。活动编号:" + addParticipant.ActivityId; packageInfo.NotifyUrl = string.Format("http://{0}/pay/wx_Pay.aspx", base.Request.Url.Host); packageInfo.OutTradeNo = text; packageInfo.TotalFee = (int)(totalPrice * 100m); if (packageInfo.TotalFee < 1m) { packageInfo.TotalFee = 1m; } string openId = ""; MemberInfo currentMember = MemberProcessor.GetCurrentMember(); if (currentMember != null) { openId = currentMember.OpenId; } else { this.pay_json = "{\"msg\":\"用户OPENID不存在,无法支付!\"}"; } packageInfo.OpenId = openId; SiteSettings masterSettings = SettingsManager.GetMasterSettings(true); 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, "", ""); } if (!payClient.checkSetParams(out this.CheckValue)) { return; } if (!payClient.checkPackage(packageInfo, out this.CheckValue)) { return; } PayRequestInfo payRequestInfo = payClient.BuildPayRequest(packageInfo); this.pay_json = this.ConvertPayJson(payRequestInfo); if (!payRequestInfo.package.ToLower().StartsWith("prepay_id=wx")) { this.CheckValue = payRequestInfo.package; } }
private void AjaxAction(string action) { string s = "{\"state\":false,\"msg\":\"未定义操作\"}"; System.Collections.Specialized.NameValueCollection form = base.Request.Form; if (action != null) { if (!(action == "edit")) { if (!(action == "save")) { if (!(action == "read")) { goto IL_417; } } else { try { OneyuanTaoInfo oneyuanTaoInfo = new OneyuanTaoInfo(); oneyuanTaoInfo.IsOn = true; oneyuanTaoInfo.IsEnd = false; oneyuanTaoInfo.PrizeNumber = int.Parse(form["PrizeNumber"]); oneyuanTaoInfo.ActivityDec = form["ActivityDec"]; oneyuanTaoInfo.Title = form["Title"]; oneyuanTaoInfo.StartTime = System.DateTime.Parse(form["StartTime"]); oneyuanTaoInfo.EndTime = System.DateTime.Parse(form["EndTime"]); oneyuanTaoInfo.EachPrice = decimal.Parse(form["EachPrice"]); oneyuanTaoInfo.ReachNum = int.Parse(form["ReachNum"]); oneyuanTaoInfo.EachCanBuyNum = int.Parse(form["EachCanBuyNum"]); oneyuanTaoInfo.FitMember = form["FitMember"]; oneyuanTaoInfo.DefualtGroup = form["DefualtGroup"]; oneyuanTaoInfo.CustomGroup = form["CustomGroup"]; oneyuanTaoInfo.FinishedNum = 0; oneyuanTaoInfo.SkuId = "N"; oneyuanTaoInfo.ProductImg = form["ProductImg"]; oneyuanTaoInfo.ProductId = int.Parse(form["ProductId"]); oneyuanTaoInfo.HeadImgage = form["HeadImgage"]; oneyuanTaoInfo.ReachType = int.Parse(form["ReachType"]); oneyuanTaoInfo.ProductPrice = decimal.Parse(form["ProductPrice"]); oneyuanTaoInfo.ProductTitle = form["ProductTitle"]; if (oneyuanTaoInfo.ActivityDec.Length > 100) { s = "{\"state\":false,\"msg\":\"活动描述信息太长!\"}"; } else if (OneyuanTaoHelp.AddOneyuanTao(oneyuanTaoInfo)) { s = "{\"state\":true,\"msg\":\"保存活动成功\"}"; } else { s = "{\"state\":false,\"msg\":\"保存活动失败\"}"; } goto IL_417; } catch (System.Exception ex) { s = "{\"state\":false,\"msg\":\"" + ex.Message.Replace("'", " ").Replace("\r\n", " ") + "\"}"; goto IL_417; } } s = "{\"state\":false,\"msg\":\"读取数据\"}"; } else { OneyuanTaoInfo oneyuanTaoInfoById = OneyuanTaoHelp.GetOneyuanTaoInfoById(form["ActivityId"]); if (oneyuanTaoInfoById != null) { this.OneTaoState = OneyuanTaoHelp.getOneTaoState(oneyuanTaoInfoById); if (this.OneTaoState == OneTaoState.已结束) { s = "{\"state\":false,\"msg\":\"当前活动已结束,不能再修改!\"}"; } else { oneyuanTaoInfoById.ActivityDec = form["ActivityDec"]; oneyuanTaoInfoById.Title = form["Title"]; oneyuanTaoInfoById.FitMember = form["FitMember"]; oneyuanTaoInfoById.DefualtGroup = form["DefualtGroup"]; oneyuanTaoInfoById.CustomGroup = form["CustomGroup"]; oneyuanTaoInfoById.HeadImgage = form["HeadImgage"]; if (this.OneTaoState == OneTaoState.未开始) { oneyuanTaoInfoById.ProductId = int.Parse(form["ProductId"]); oneyuanTaoInfoById.StartTime = System.DateTime.Parse(form["StartTime"]); oneyuanTaoInfoById.EndTime = System.DateTime.Parse(form["EndTime"]); oneyuanTaoInfoById.EachPrice = decimal.Parse(form["EachPrice"]); oneyuanTaoInfoById.ReachNum = int.Parse(form["ReachNum"]); oneyuanTaoInfoById.EachCanBuyNum = int.Parse(form["EachCanBuyNum"]); oneyuanTaoInfoById.PrizeNumber = int.Parse(form["PrizeNumber"]); oneyuanTaoInfoById.ReachType = int.Parse(form["ReachType"]); oneyuanTaoInfoById.ProductPrice = decimal.Parse(form["ProductPrice"]); oneyuanTaoInfoById.ProductTitle = form["ProductTitle"]; oneyuanTaoInfoById.FinishedNum = 0; oneyuanTaoInfoById.SkuId = "N"; oneyuanTaoInfoById.ProductImg = form["ProductImg"]; } if (oneyuanTaoInfoById.ActivityDec.Length > 100) { s = "{\"state\":false,\"msg\":\"活动描述信息太长!\"}"; } else if (OneyuanTaoHelp.UpdateOneyuanTao(oneyuanTaoInfoById)) { s = "{\"state\":true,\"msg\":\"活动修改成功!\"}"; } else { s = "{\"state\":false,\"msg\":\"修改失败!\"}"; } } } else { s = "{\"state\":false,\"msg\":\"活动信息不存在,可能已删除!\"}"; } } } IL_417: base.Response.ClearContent(); base.Response.ContentType = "application/json"; base.Response.Write(s); base.Response.End(); }
protected override void AttachChildControls() { this.Vaid = Globals.RequestQueryStr("vaid"); if (string.IsNullOrEmpty(this.Vaid)) { base.GotoResourceNotFound(""); } OneyuanTaoInfo oneyuanTaoInfoById = OneyuanTaoHelp.GetOneyuanTaoInfoById(this.Vaid); if (oneyuanTaoInfoById == null) { base.GotoResourceNotFound(""); } this.productId = oneyuanTaoInfoById.ProductId; ProductInfo product = ProductBrowser.GetProduct(MemberProcessor.GetCurrentMember(), this.productId); if (product == null) { base.GotoResourceNotFound(""); } OneTaoState state = OneyuanTaoHelp.getOneTaoState(oneyuanTaoInfoById); this.rptProductImages = (VshopTemplatedRepeater)this.FindControl("rptProductImages"); this.litItemParams = (Literal)this.FindControl("litItemParams"); this.litProdcutName = (Literal)this.FindControl("litProdcutName"); this.litProdcutTag = (Literal)this.FindControl("litProdcutTag"); this.litSalePrice = (Literal)this.FindControl("litSalePrice"); this.litMarketPrice = (Literal)this.FindControl("litMarketPrice"); this.litShortDescription = (Literal)this.FindControl("litShortDescription"); this.litDescription = (Literal)this.FindControl("litDescription"); this.litStock = (Literal)this.FindControl("litStock"); this.litSoldCount = (Literal)this.FindControl("litSoldCount"); this.litConsultationsCount = (Literal)this.FindControl("litConsultationsCount"); this.litReviewsCount = (Literal)this.FindControl("litReviewsCount"); this.litActivityId = (Literal)this.FindControl("litActivityId"); this.litState = (Literal)this.FindControl("litState"); this.PrizeTime = (HtmlControl)this.FindControl("PrizeTime"); this.buyNum = (HtmlControl)this.FindControl("buyNum"); this.SaveBtn = (HtmlControl)this.FindControl("SaveBtn"); this.ViewtReview = (HtmlControl)this.FindControl("ViewtReview"); this.litMaxtxt = (Literal)this.FindControl("litMaxtxt"); this.expandAttr = (Common_ExpandAttributes)this.FindControl("ExpandAttributes"); this.skuSelector = (Common_SKUSelector)this.FindControl("skuSelector"); this.NomachMember = (HtmlContainerControl)this.FindControl("NomachMember"); this.litMinNum = (Literal)this.FindControl("litMinNum"); this.litPrizeNum = (Literal)this.FindControl("litPrizeNum"); this.litFinished = (Literal)this.FindControl("litFinished"); this.Prizeprogress = (HtmlControl)this.FindControl("Prizeprogress"); this.litBuytxt = (Literal)this.FindControl("litBuytxt"); this.litPrizeNum.Text = oneyuanTaoInfoById.ReachNum.ToString(); this.litFinished.Text = oneyuanTaoInfoById.FinishedNum.ToString(); int num = oneyuanTaoInfoById.ReachNum - oneyuanTaoInfoById.FinishedNum; if (num < 0) { num = 0; } this.litMinNum.Text = num.ToString(); float num2 = (100 * oneyuanTaoInfoById.FinishedNum) / oneyuanTaoInfoById.ReachNum; this.Prizeprogress.Attributes.Add("style", "width:" + num2.ToString("F0") + "%"); this.ViewtReview.Attributes.Add("href", "ProductReview.aspx?ProductId=" + oneyuanTaoInfoById.ProductId.ToString()); if (this.expandAttr != null) { this.expandAttr.ProductId = this.productId; } this.skuSelector.ProductId = this.productId; if (product != null) { //if (this.rptProductImages != null) //{ // string locationUrl = "javascript:;"; // SlideImage[] imageArray = new SlideImage[] { new SlideImage(product.ImageUrl1, locationUrl), new SlideImage(product.ImageUrl2, locationUrl), new SlideImage(product.ImageUrl3, locationUrl), new SlideImage(product.ImageUrl4, locationUrl), new SlideImage(product.ImageUrl5, locationUrl) }; // if (CS$<>9__CachedAnonymousMethodDelegate1 == null) // { // CS$<>9__CachedAnonymousMethodDelegate1 = new Func<SlideImage, bool>(null, (IntPtr) <AttachChildControls>b__0); // } // this.rptProductImages.DataSource = Enumerable.Where<SlideImage>(imageArray, CS$<>9__CachedAnonymousMethodDelegate1); // this.rptProductImages.DataBind(); //} if (this.rptProductImages != null) { string locationUrl = "javascript:;"; SlideImage[] imageArray = new SlideImage[] { new SlideImage(product.ImageUrl1, locationUrl), new SlideImage(product.ImageUrl2, locationUrl), new SlideImage(product.ImageUrl3, locationUrl), new SlideImage(product.ImageUrl4, locationUrl), new SlideImage(product.ImageUrl5, locationUrl) }; this.rptProductImages.DataSource = from item in imageArray where !string.IsNullOrWhiteSpace(item.ImageUrl) select item; this.rptProductImages.DataBind(); } this.litShortDescription.Text = product.ShortDescription; } int num3 = OneyuanTaoHelp.MermberCanbuyNum(oneyuanTaoInfoById.ActivityId, Globals.GetCurrentMemberUserId()); this.buyNum.Attributes.Add("max", num3.ToString()); this.litBuytxt.Text = string.Concat(new object[] { "限购", oneyuanTaoInfoById.EachCanBuyNum, "份,每份价格¥", oneyuanTaoInfoById.EachPrice.ToString("F2") }); this.litMaxtxt.Text = "您已订购<di>" + ((oneyuanTaoInfoById.EachCanBuyNum - num3)).ToString() + "</di>份"; if (!(((num3 != 0) && (state == OneTaoState.进行中)) && MemberHelper.CheckCurrentMemberIsInRange(oneyuanTaoInfoById.FitMember, oneyuanTaoInfoById.DefualtGroup, oneyuanTaoInfoById.CustomGroup, base.CurrentMemberInfo.UserId))) { this.buyNum.Attributes.Add("disabled", "disabled"); this.SaveBtn.Visible = false; } string str2 = "全部会员"; if ((oneyuanTaoInfoById.FitMember == "0") || (oneyuanTaoInfoById.CustomGroup == "0")) { str2 = "全部会员"; } else { str2 = "部分会员"; } str2 = "适用会员:" + str2; if (!(!(oneyuanTaoInfoById.FitMember != "0") || MemberHelper.CheckCurrentMemberIsInRange(oneyuanTaoInfoById.FitMember, oneyuanTaoInfoById.DefualtGroup, oneyuanTaoInfoById.CustomGroup, base.CurrentMemberInfo.UserId))) { str2 = "会员等级不符合活动要求"; this.NomachMember.Attributes.Add("CanBuy", "false"); } this.NomachMember.InnerHtml = str2; string productName = product.ProductName; string description = product.Description; if (!string.IsNullOrEmpty(description)) { description = Regex.Replace(description, "<img[^>]*\\bsrc=('|\")([^'\">]*)\\1[^>]*>", "<img alt='" + HttpContext.Current.Server.HtmlEncode(productName) + "' src='$2' />", RegexOptions.IgnoreCase); } if (this.litDescription != null) { this.litDescription.Text = description; } this.litProdcutName.Text = productName; this.litSalePrice.Text = product.MinSalePrice.ToString("F2"); this.litActivityId.Text = oneyuanTaoInfoById.ActivityId; if (oneyuanTaoInfoById.ReachType == 1) { this.litActivityId.Text = "活动结束前满足总需份数,自动开出" + oneyuanTaoInfoById.PrizeNumber + "个奖品"; } else if (oneyuanTaoInfoById.ReachType == 2) { this.litActivityId.Text = "活动到期自动开出" + oneyuanTaoInfoById.PrizeNumber + "个奖品"; } else if (oneyuanTaoInfoById.ReachType == 3) { this.litActivityId.Text = "到开奖时间并满足总需份数,自动开出" + oneyuanTaoInfoById.PrizeNumber + "个奖品"; } this.PrizeTime.Attributes.Add("PrizeTime", oneyuanTaoInfoById.EndTime.ToString("G")); this.litState.Text = state.ToString(); if (state == OneTaoState.已开奖) { IsoDateTimeConverter converter = new IsoDateTimeConverter { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" }; Literal literal = (Literal)this.FindControl("LitDataJson"); IList <LuckInfo> list = OneyuanTaoHelp.getWinnerLuckInfoList(oneyuanTaoInfoById.ActivityId, ""); if (list != null) { literal.Text = "var LitDataJson=" + JsonConvert.SerializeObject(list, new JsonConverter[] { converter }); } else { literal.Text = "var LitDataJson=null"; } } Literal literal2 = (Literal)this.FindControl("litJs"); string title = oneyuanTaoInfoById.Title; string activityDec = oneyuanTaoInfoById.ActivityDec; Uri url = this.Context.Request.Url; string str7 = url.Scheme + "://" + url.Host + ((url.Port == 80) ? "" : (":" + url.Port.ToString())); string productImg = oneyuanTaoInfoById.ProductImg; if (productImg == "/utility/pics/none.gif") { productImg = oneyuanTaoInfoById.HeadImgage; } literal2.Text = "<script>wxinshare_title=\"" + this.Context.Server.HtmlEncode(title.Replace("\n", " ").Replace("\r", "")) + "\";wxinshare_desc=\"" + this.Context.Server.HtmlEncode(activityDec.Replace("\n", " ").Replace("\r", "")) + "\";wxinshare_link=location.href;wxinshare_imgurl=\"" + str7 + productImg + "\"</script>"; PageTitle.AddSiteNameTitle("一元夺宝商品详情"); }
protected override void AttachChildControls() { string activityId = ""; string str2 = Globals.RequestQueryStr("Pid"); if (string.IsNullOrEmpty(str2)) { base.GotoResourceNotFound(""); } OneyuanTaoParticipantInfo info = OneyuanTaoHelp.GetAddParticipant(0, str2, ""); if (info == null) { base.GotoResourceNotFound(""); } activityId = info.ActivityId; OneyuanTaoInfo oneyuanTaoInfoById = OneyuanTaoHelp.GetOneyuanTaoInfoById(activityId); if (oneyuanTaoInfoById == null) { base.GotoResourceNotFound(""); } this.litProdcutName = (Literal)this.FindControl("litProdcutName"); this.litProdcutAttr = (Literal)this.FindControl("litProdcutAttr"); this.litActivityID = (Literal)this.FindControl("litActivityID"); this.litReachType = (Literal)this.FindControl("litReachType"); this.litPrice = (Literal)this.FindControl("litPrice"); this.litBuyNum = (Literal)this.FindControl("litBuyNum"); this.litPayPrice = (Literal)this.FindControl("litPayPrice"); this.ProductImg = (HtmlImage)this.FindControl("ProductImg"); this.PayWaytxt = (HtmlContainerControl)this.FindControl("PayWaytxt"); this.PayBtn = (HtmlContainerControl)this.FindControl("PayBtn"); this.litProdcutName.Text = oneyuanTaoInfoById.ProductTitle; this.litProdcutAttr.Text = info.SkuIdStr; this.litActivityID.Text = activityId; this.litReachType.Text = ""; this.litPrice.Text = oneyuanTaoInfoById.EachPrice.ToString("F2"); this.litBuyNum.Text = info.BuyNum.ToString(); this.litPayPrice.Text = info.TotalPrice.ToString("F2"); this.ProductImg.Src = oneyuanTaoInfoById.ProductImg; if (oneyuanTaoInfoById.ReachType == 1) { this.litReachType.Text = "满足参与人数自动开奖"; } else if (oneyuanTaoInfoById.ReachType == 2) { this.litReachType.Text = "活动到期自动开奖"; } else { this.litReachType.Text = "活动到期时且满足参与人数自动开奖"; } SiteSettings masterSettings = SettingsManager.GetMasterSettings(true); string str3 = "商家尚未开启网上支付功能!"; this.PayBtn.Visible = false; if (!(this.Page.Request.UserAgent.ToLower().Contains("micromessenger") || !masterSettings.EnableAlipayRequest)) { str3 = "支付宝手机支付"; this.PayBtn.Visible = true; } else if (masterSettings.EnableWeiXinRequest && this.Page.Request.UserAgent.ToLower().Contains("micromessenger")) { str3 = "微信支付"; this.PayBtn.Visible = true; } this.PayWaytxt.InnerText = "当前可用支付方式:" + str3; this.PayWaytxt.Attributes.Add("Pid", str2); PageTitle.AddSiteNameTitle("结算支付"); }
private void AjaxAction(string action) { string[] strArray; OneyuanTaoInfo oneyuanTaoInfoById; string s = "{\"state\":false,\"msg\":\"未定义操作\"}"; NameValueCollection form = base.Request.Form; string str2 = ""; switch (action) { case "Del": s = "{\"state\":false,\"msg\":\"活动信息未找到失败\"}"; str2 = form["Aid"]; if (!string.IsNullOrEmpty(str2) && (OneyuanTaoHelp.GetOneyuanTaoInfoById(str2) != null)) { if (!OneyuanTaoHelp.DeleteOneyuanTao(str2)) { s = "{\"state\":false,\"msg\":\"该活动已有人参与,不能删除!\"}"; break; } s = "{\"state\":true,\"msg\":\"删除成功\"}"; OneyuanTaoHelp.DelParticipantMember(str2, true); } break; case "BatchDel": s = "{\"state\":false,\"msg\":\"批量删除失败\"}"; str2 = form["Aids"]; if (!string.IsNullOrEmpty(str2)) { strArray = str2.Split(new char[] { ',' }); int num = OneyuanTaoHelp.BatchDeleteOneyuanTao(strArray); if (num <= 0) { s = "{\"state\":false,\"msg\":\"没有找到可删除的数据!\"}"; break; } string[] strArray2 = new string[] { "{\"state\":true,\"msg\":\"成功删除", num.ToString(), "条数据,失败", (strArray.Length - num).ToString(), "条!\"}" }; s = string.Concat(strArray2); foreach (string str3 in strArray) { OneyuanTaoHelp.DelParticipantMember(str3, true); } } break; case "EndII": { s = "{\"state\":false,\"msg\":\"结束失败\"}"; str2 = form["Aid"]; string str4 = form["CanDraw"]; if (!string.IsNullOrEmpty(str2) && !string.IsNullOrEmpty(str4)) { if (str4.Trim() == "1") { s = "{\"state\":false,\"msg\":\"开奖错误\"}"; string str5 = OneyuanTaoHelp.CalculateWinner(str2); if (str5 == "success") { s = "{\"state\":true,\"msg\":\"手动开奖成功!\"}"; } else { s = "{\"state\":false,\"msg\":\"" + str5 + "\"}"; } } else { s = "{\"state\":false,\"msg\":\"退款错误\"}"; if (OneyuanTaoHelp.SetOneyuanTaoIsOn(str2, false)) { s = "{\"state\":true,\"msg\":\"提前终止活动成功!!\"}"; OneyuanTaoHelp.DelParticipantMember(str2, true); } else { s = "{\"state\":false,\"msg\":\"提前终止活动失败!\"}"; } } break; } s = "{\"state\":false,\"msg\":\"参数错误\"}"; break; } case "End": s = "{\"state\":false,\"msg\":\"结束失败\"}"; str2 = form["Aid"]; if (!string.IsNullOrEmpty(str2)) { oneyuanTaoInfoById = OneyuanTaoHelp.GetOneyuanTaoInfoById(str2); if (oneyuanTaoInfoById != null) { if (this.getOneTaoState(oneyuanTaoInfoById) != OneTaoState.进行中) { s = "{\"state\":false,\"msg\":\"提前终止活动失败!\"}"; break; } if (!OneyuanTaoHelp.SetOneyuanTaoIsOn(str2, false)) { s = "{\"state\":false,\"msg\":\"提前终止活动失败!\"}"; break; } s = "{\"state\":true,\"msg\":\"提前终止活动成功!!\"}"; OneyuanTaoHelp.DelParticipantMember(str2, true); } } break; case "Start": s = "{\"state\":false,\"msg\":\"操作开始失败\"}"; str2 = form["Aid"]; if (!string.IsNullOrEmpty(str2)) { oneyuanTaoInfoById = OneyuanTaoHelp.GetOneyuanTaoInfoById(str2); if (oneyuanTaoInfoById != null) { if (this.getOneTaoState(oneyuanTaoInfoById) != OneTaoState.未开始) { s = "{\"state\":false,\"msg\":\"当前状态开启活动!\"}"; break; } if (!OneyuanTaoHelp.SetOneyuanTaoIsOn(str2, true)) { s = "{\"state\":false,\"msg\":\"当前状态不能结束!\"}"; break; } s = "{\"state\":true,\"msg\":\"提前开启活动成功!!\"}"; } } break; case "BatchStart": s = "{\"state\":false,\"msg\":\"批量操作开始失败\"}"; str2 = form["Aids"]; if (!string.IsNullOrEmpty(str2)) { strArray = str2.Split(new char[] { ',' }); int num2 = OneyuanTaoHelp.BatchSetOneyuanTaoIsOn(strArray, true); if (num2 <= 0) { s = "{\"state\":false,\"msg\":\"没有找到可开启的活动数据!\"}"; break; } string[] strArray4 = new string[] { "{\"state\":true,\"msg\":\"成功开启", num2.ToString(), "条活动,失败", (strArray.Length - num2).ToString(), "条!\"}" }; s = string.Concat(strArray4); } break; } base.Response.ClearContent(); base.Response.ContentType = "application/json"; base.Response.Write(s); base.Response.End(); }
private void DoOneTaoPay(string Pid) { if (string.IsNullOrEmpty(Pid)) { base.Response.Write("支付参数不正确!<a href='javascript:history.go(-1);'>返回上一页</a>"); base.Response.End(); } OneyuanTaoParticipantInfo info = OneyuanTaoHelp.GetAddParticipant(0, Pid, ""); if (info == null) { base.Response.Write("您的夺宝信息已被删除!<a href='javascript:history.go(-1);'>返回上一页</a>"); base.Response.End(); } OneyuanTaoInfo oneyuanTaoInfoById = OneyuanTaoHelp.GetOneyuanTaoInfoById(info.ActivityId); if (oneyuanTaoInfoById == null) { base.Response.Write("夺宝活动已被删除,你无法完成支付!<a href='javascript:history.go(-1);'>返回上一页</a>"); base.Response.End(); } OneTaoState state = OneyuanTaoHelp.getOneTaoState(oneyuanTaoInfoById); if (state != OneTaoState.进行中) { base.Response.Write("当前活动" + state.ToString() + ",无法支付!<a href='javascript:history.go(-1);'>返回上一页</a>"); base.Response.End(); } if ((oneyuanTaoInfoById.FinishedNum + info.BuyNum) > oneyuanTaoInfoById.ReachNum) { base.Response.Write("活动已满员,您可以试下其它活动!<a href='/Vshop/OneyuanList.aspx'>夺宝活动中心</a>"); base.Response.End(); } SiteSettings masterSettings = SettingsManager.GetMasterSettings(true); string partner = masterSettings.Alipay_Pid; string str3 = masterSettings.Alipay_Key; string str4 = "utf-8"; Hidistro.ControlPanel.OutPay.App.Core.setConfig(partner, "MD5", str3, str4); string str5 = "1"; string str6 = Globals.FullPath("/Vshop/OneTaoPaySuccess.aspx"); string str7 = Globals.FullPath("/Pay/wap_alipay_notify_url.aspx"); string str8 = Pid; string str9 = "订单支付"; decimal totalPrice = info.TotalPrice; string str10 = Globals.FullPath("/Vshop/OneTaoPayView.aspx?Pid=") + Pid; string str11 = SettingsManager.GetMasterSettings(false).SiteName + "支付,当前支付编号-" + Pid + " ..."; string str12 = "1m"; string str13 = ""; SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>(); sParaTemp.Add("partner", partner); sParaTemp.Add("seller_id", partner); sParaTemp.Add("_input_charset", str4); sParaTemp.Add("service", "alipay.wap.create.direct.pay.by.user"); sParaTemp.Add("payment_type", str5); sParaTemp.Add("notify_url", str7); sParaTemp.Add("return_url", str6); sParaTemp.Add("out_trade_no", str8); sParaTemp.Add("subject", str9); sParaTemp.Add("total_fee", totalPrice.ToString("F")); sParaTemp.Add("show_url", str10); sParaTemp.Add("body", str11); sParaTemp.Add("it_b_pay", str12); sParaTemp.Add("extern_token", str13); string s = Hidistro.ControlPanel.OutPay.App.Core.BuildRequest(sParaTemp, "get", "确认"); base.Response.Write(s); }
protected void Page_Load(object sender, EventArgs e) { string str = base.Request.QueryString.Get("orderId"); if (string.IsNullOrEmpty(str)) { this.pay_json = "{\"msg\":\"订单参数错误!\"}"; } else { OneyuanTaoParticipantInfo info = OneyuanTaoHelp.GetAddParticipant(0, str, ""); if (info == null) { this.pay_json = "{\"msg\":\"订单不存在了!\"}"; } else { OneyuanTaoInfo oneyuanTaoInfoById = OneyuanTaoHelp.GetOneyuanTaoInfoById(info.ActivityId); if (oneyuanTaoInfoById == null) { this.pay_json = "{\"msg\":\"活动已取消,禁止参与!\"}"; } else { OneTaoState state = OneyuanTaoHelp.getOneTaoState(oneyuanTaoInfoById); if (state != OneTaoState.进行中) { this.pay_json = "{\"msg\":\"您来晚了,活动已结束!\"}"; } else if (state != OneTaoState.进行中) { this.pay_json = "{\"msg\":\"您来晚了,活动已结束!\"}"; } else if ((oneyuanTaoInfoById.ReachType == 1) && ((oneyuanTaoInfoById.FinishedNum + info.BuyNum) > oneyuanTaoInfoById.ReachNum)) { this.pay_json = "{\"msg\":\"活动已满员,您来晚了!\"}"; } else { PayClient client; decimal totalPrice = info.TotalPrice; PackageInfo package = new PackageInfo { Body = "一元夺宝。当前活动编号:" + info.ActivityId, NotifyUrl = string.Format("http://{0}/pay/wx_Pay.aspx", base.Request.Url.Host), OutTradeNo = str, TotalFee = (int)(totalPrice * 100M) }; if (package.TotalFee < 1M) { package.TotalFee = 1M; } string openId = ""; MemberInfo currentMember = MemberProcessor.GetCurrentMember(); if (currentMember != null) { openId = currentMember.OpenId; } else { this.pay_json = "{\"msg\":\"用户OPENID不存在,无法支付!\"}"; } package.OpenId = openId; SiteSettings masterSettings = SettingsManager.GetMasterSettings(true); 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, "", ""); } if (client.checkSetParams(out this.CheckValue) && client.checkPackage(package, out this.CheckValue)) { PayRequestInfo req = client.BuildPayRequest(package); this.pay_json = this.ConvertPayJson(req); if (!req.package.ToLower().StartsWith("prepay_id=wx")) { this.CheckValue = req.package; } } } } } } }