public void CopyRedEnvelope(string openId, MemberInfo memberInfo) { IList <RedEnvelopeGetRecordInfo> list = WeiXinRedEnvelopeProcessor.GettWaitToUserRedEnvelopeGetRecord(openId); foreach (RedEnvelopeGetRecordInfo item in list) { WeiXinRedEnvelopeInfo weiXinRedEnvelope = WeiXinRedEnvelopeProcessor.GetWeiXinRedEnvelope(item.RedEnvelopeId); if (weiXinRedEnvelope != null) { CouponItemInfo couponItemInfo = new CouponItemInfo(); couponItemInfo.UserId = memberInfo.UserId; couponItemInfo.UserName = memberInfo.UserName; couponItemInfo.CanUseProducts = ""; couponItemInfo.ClosingTime = weiXinRedEnvelope.EffectivePeriodEndTime; couponItemInfo.CouponId = 0; couponItemInfo.RedEnvelopeId = weiXinRedEnvelope.Id; couponItemInfo.CouponName = weiXinRedEnvelope.Name; couponItemInfo.OrderUseLimit = weiXinRedEnvelope.EnableUseMinAmount; couponItemInfo.Price = item.Amount; couponItemInfo.StartTime = weiXinRedEnvelope.EffectivePeriodStartTime; couponItemInfo.UseWithGroup = false; couponItemInfo.UseWithPanicBuying = false; couponItemInfo.GetDate = DateTime.Now; if (WeiXinRedEnvelopeProcessor.SetRedEnvelopeGetRecordToMember(item.Id, memberInfo.UserName)) { CouponActionStatus couponActionStatus = CouponHelper.AddRedEnvelopeItemInfo(couponItemInfo); } } } }
public decimal GetRedEnvelopeAmount(WeiXinRedEnvelopeInfo weiXinRedEnvelope) { if (weiXinRedEnvelope.MinAmount == weiXinRedEnvelope.MaxAmount) { return(weiXinRedEnvelope.MaxAmount); } return(this.GetRandomNumber(weiXinRedEnvelope.MinAmount, weiXinRedEnvelope.MaxAmount, 2)); }
public void CopyRedEnvelope(string openId, MemberInfo memberInfo) { IDictionary <string, string> dictionary = new Dictionary <string, string>(); dictionary.Add("OpenId", openId); dictionary.Add("UserName", memberInfo.UserName); try { IList <RedEnvelopeGetRecordInfo> list = WeiXinRedEnvelopeProcessor.GettWaitToUserRedEnvelopeGetRecord(openId); if (list == null || list.Count == 0) { dictionary.Add("RedEnvelopeErrMsg", "红包记录为空"); } int num = 1; foreach (RedEnvelopeGetRecordInfo item in list) { WeiXinRedEnvelopeInfo weiXinRedEnvelope = WeiXinRedEnvelopeProcessor.GetWeiXinRedEnvelope(item.RedEnvelopeId); if (weiXinRedEnvelope == null) { dictionary.Add("RedEnvelopeErrMsg" + num, "红包信息为空" + item.RedEnvelopeId.ToNullString()); } else { CouponItemInfo couponItemInfo = new CouponItemInfo(); couponItemInfo.UserId = memberInfo.UserId; couponItemInfo.UserName = memberInfo.UserName; couponItemInfo.CanUseProducts = ""; couponItemInfo.ClosingTime = weiXinRedEnvelope.EffectivePeriodEndTime; couponItemInfo.RedEnvelopeId = weiXinRedEnvelope.Id; couponItemInfo.CouponName = weiXinRedEnvelope.Name; couponItemInfo.OrderUseLimit = weiXinRedEnvelope.EnableUseMinAmount; couponItemInfo.Price = item.Amount; couponItemInfo.StartTime = weiXinRedEnvelope.EffectivePeriodStartTime; couponItemInfo.UseWithGroup = false; couponItemInfo.UseWithPanicBuying = false; couponItemInfo.GetDate = DateTime.Now; if (WeiXinRedEnvelopeProcessor.SetRedEnvelopeGetRecordToMember(item.Id, memberInfo.UserName)) { CouponActionStatus couponActionStatus = CouponHelper.AddRedEnvelopeItemInfo(couponItemInfo); if (couponActionStatus != 0) { dictionary.Add("SendDiffentTypeClaimCodesErrMsg" + num, "发送优惠券失败-" + couponActionStatus.ToString()); } num++; } else { dictionary.Add("SetRedEnvelopeGetRecordToMemberErrMsg" + num, "设置红包记录给会员失败"); } } } } catch (Exception ex) { Globals.WriteExceptionLog(ex, dictionary, "RedEnvelope"); } }
protected override void AttachChildControls() { this.CheckSendRedEnvelope(); this.hdAppId = (HiddenField)this.FindControl("hdAppId"); this.hdTimestamp = (HiddenField)this.FindControl("hdTimestamp"); this.hdNonceStr = (HiddenField)this.FindControl("hdNonceStr"); this.hdSignature = (HiddenField)this.FindControl("hdSignature"); this.hdTitle = (HiddenField)this.FindControl("hdTitle"); this.hdDesc = (HiddenField)this.FindControl("hdDesc"); this.hdImgUrl = (HiddenField)this.FindControl("hdImgUrl"); this.hdLink = (HiddenField)this.FindControl("hdLink"); this.hdSendCode = (HiddenField)this.FindControl("hdSendCode"); this.hdRedEnvelopeId = (HiddenField)this.FindControl("hdRedEnvelopeId"); this.hdOrderId = (HiddenField)this.FindControl("hdOrderId"); this.hdAppId.Value = base.site.WeixinAppId; string jsApiTicket = base.GetJsApiTicket(true); string text = WAPTemplatedWebControl.GenerateNonceStr(); string text2 = WAPTemplatedWebControl.GenerateTimeStamp(); string absoluteUri = this.Page.Request.Url.AbsoluteUri; this.hdTimestamp.Value = text2; this.hdNonceStr.Value = text; this.hdSignature.Value = base.GetSignature(jsApiTicket, text, text2, absoluteUri); WeiXinRedEnvelopeInfo openedWeiXinRedEnvelope = WeiXinRedEnvelopeProcessor.GetOpenedWeiXinRedEnvelope(); string text3 = this.orderId; int id = openedWeiXinRedEnvelope.Id; RedEnvelopeSendRecord redEnvelopeSendRecord = WeiXinRedEnvelopeProcessor.GetRedEnvelopeSendRecord(text3, id.ToString()); Guid guid; if (redEnvelopeSendRecord != null) { this.hdRedEnvelopeId.Value = redEnvelopeSendRecord.RedEnvelopeId.ToString(); this.hdTitle.Value = openedWeiXinRedEnvelope.Name; this.hdDesc.Value = openedWeiXinRedEnvelope.ShareDetails; this.hdImgUrl.Value = Globals.FullPath(openedWeiXinRedEnvelope.ShareIcon); HiddenField hiddenField = this.hdSendCode; guid = redEnvelopeSendRecord.SendCode; hiddenField.Value = guid.ToString(); this.hdLink.Value = Globals.FullPath("/Vshop/GetRedEnvelope?SendCode=" + this.hdSendCode.Value + "&OrderId=" + this.orderId); this.hdOrderId.Value = this.orderId; } else { HiddenField hiddenField2 = this.hdRedEnvelopeId; id = openedWeiXinRedEnvelope.Id; hiddenField2.Value = id.ToString(); this.hdTitle.Value = openedWeiXinRedEnvelope.Name; this.hdDesc.Value = openedWeiXinRedEnvelope.ShareDetails; this.hdImgUrl.Value = Globals.FullPath(openedWeiXinRedEnvelope.ShareIcon); HiddenField hiddenField3 = this.hdSendCode; guid = Guid.NewGuid(); hiddenField3.Value = guid.ToString(); this.hdLink.Value = Globals.FullPath("/Vshop/GetRedEnvelope?SendCode=" + this.hdSendCode.Value + "&OrderId=" + this.orderId); this.hdOrderId.Value = this.orderId; } }
protected void Submit_Click(object sender, EventArgs e) { WeiXinRedEnvelopeInfo weiXinRedEnvelopeInfo = new WeiXinRedEnvelopeInfo(); if (this.CheckeGetWeiXinRedEnvelope(weiXinRedEnvelopeInfo)) { weiXinRedEnvelopeInfo.ShareIcon = this.UploadImage(); WeiXinRedEnvelopeProcessor.AddWeiXinRedEnvelope(weiXinRedEnvelopeInfo); this.txtName.Text = string.Empty; this.ShowMsg("代金红包促销添加成功!", true); } }
private void AddRedEnvelope_ServerClick(object sender, EventArgs e) { WeiXinRedEnvelopeInfo openedWeiXinRedEnvelope = WeiXinRedEnvelopeProcessor.GetOpenedWeiXinRedEnvelope(); if (openedWeiXinRedEnvelope == null) { this.Page.Response.Redirect("AddRedEnvelope.aspx", true); } else { this.ShowMsg("已经存在正在进行中的活动,不能再次添加!", false); } }
private bool CheckRedEnvelope(string sendCode, string orderId) { if (string.IsNullOrEmpty(sendCode)) { this.Page.Response.Redirect("/Vshop/RedEnvelopeError?errorInfo=发送码错误", true); } if (string.IsNullOrEmpty(orderId)) { NameValueCollection nameValueCollection = new NameValueCollection { this.Context.Request.QueryString, this.Context.Request.Form }; nameValueCollection.Add("OrderId1", orderId); nameValueCollection.Add("sendCode1", sendCode); Globals.AppendLog(nameValueCollection, "", "", "", "CheckRedEnvelope"); this.Page.Response.Redirect("/Vshop/RedEnvelopeError?errorInfo=订单编号为空", true); } OrderInfo orderInfo = TradeHelper.GetOrderInfo(orderId); if (orderInfo == null) { this.Page.Response.Redirect("/Vshop/RedEnvelopeError?errorInfo=订单不存在", true); } RedEnvelopeSendRecord redEnvelopeSendRecord = WeiXinRedEnvelopeProcessor.GetRedEnvelopeSendRecord(Guid.Parse(sendCode), orderId, ""); if (redEnvelopeSendRecord == null) { this.Page.Response.Redirect("/Vshop/RedEnvelopeError?errorInfo=发送码不存在", true); } this.weiXinRedEnvelope = WeiXinRedEnvelopeProcessor.GetWeiXinRedEnvelope(redEnvelopeSendRecord.RedEnvelopeId.Value); if (this.weiXinRedEnvelope == null) { this.Page.Response.Redirect("/Vshop/RedEnvelopeError?errorInfo=红包活动已经被删除", true); } if (this.weiXinRedEnvelope.State == 0) { this.Page.Response.Redirect("/Vshop/RedEnvelopeError?errorInfo=红包活动已经关闭", true); } DateTime now = DateTime.Now; if (now > this.weiXinRedEnvelope.ActiveStartTime && this.weiXinRedEnvelope.ActiveEndTime < now) { this.Page.Response.Redirect("/Vshop/RedEnvelopeError?errorInfo=红包活动没有开始或已过期", true); } return(true); }
protected void Page_Load(object sender, EventArgs e) { if (!base.IsPostBack) { string text = HiContext.Current.Context.Request.Params["OrderId"]; MemberInfo user = HiContext.Current.User; Uri url = HttpContext.Current.Request.Url; string text2 = ""; string content = $"{Globals.GetProtocal(HttpContext.Current)}://{HttpContext.Current.Request.Url.Host}{text2}//Vshop/SendRedEnvelope.aspx?OrderId={text}"; string qrCodeUrl = "/Storage/master/QRCode/redenvelope_" + HiContext.Current.Config.Version + "_" + user.UserId + ".png"; this.imgRedEnvelopeCode.ImageUrl = Globals.CreateQRCode(content, qrCodeUrl, false, ImageFormats.Png); WeiXinRedEnvelopeInfo openedWeiXinRedEnvelope = WeiXinRedEnvelopeProcessor.GetOpenedWeiXinRedEnvelope(); if (openedWeiXinRedEnvelope != null) { this.labRedEnvelopeNum.Text = openedWeiXinRedEnvelope.MaxNumber.ToString(); this.labRedEnvelopeNum.Attributes.Add("style", "color:red;"); } } }
public bool CheckSendRedEnvelope() { HttpCookie httpCookie = HiContext.Current.Context.Request.Cookies["OrderIdCookie"]; if (httpCookie != null) { this.orderId = httpCookie.Value; } else { this.orderId = HiContext.Current.Context.Request.Params["OrderId"]; } if (string.IsNullOrEmpty(this.orderId)) { return(false); } OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(this.orderId); WeiXinRedEnvelopeInfo openedWeiXinRedEnvelope = WeiXinRedEnvelopeProcessor.GetOpenedWeiXinRedEnvelope(); if (openedWeiXinRedEnvelope == null) { this.Page.Response.Redirect("/Vshop/RedEnvelopeError.aspx?errorInfo=没有找到任何红包活动", true); } else { if (openedWeiXinRedEnvelope.ActiveStartTime > DateTime.Now) { this.Page.Response.Redirect("/Vshop/RedEnvelopeError.aspx?errorInfo=红包活动还没有开始", true); } if (openedWeiXinRedEnvelope.ActiveEndTime < DateTime.Now) { this.Page.Response.Redirect("/Vshop/RedEnvelopeError.aspx?errorInfo=红包活动已经过期", true); } decimal amount = orderInfo.GetAmount(false); if (amount > decimal.Zero && amount >= openedWeiXinRedEnvelope.EnableIssueMinAmount) { return(true); } this.Page.Response.Redirect("/Vshop/RedEnvelopeError.aspx?errorInfo=你没有满足发红包的金额条件", true); } return(true); }
public void CheckSendRedEnvelope(string orderId) { OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(orderId); WeiXinRedEnvelopeInfo openedWeiXinRedEnvelope = WeiXinRedEnvelopeProcessor.GetOpenedWeiXinRedEnvelope(); if (openedWeiXinRedEnvelope != null && !(openedWeiXinRedEnvelope.ActiveEndTime > DateTime.Now) && !(openedWeiXinRedEnvelope.ActiveStartTime < DateTime.Now)) { decimal amount = orderInfo.GetAmount(false); if (amount > decimal.Zero && amount >= openedWeiXinRedEnvelope.EnableIssueMinAmount) { HttpCookie httpCookie = new HttpCookie("OrderIdCookie"); httpCookie.HttpOnly = true; httpCookie.Value = orderId; httpCookie.Expires = DateTime.Now.AddMinutes(20.0); httpCookie.HttpOnly = true; HttpContext.Current.Response.Cookies.Add(httpCookie); this.Page.Response.Redirect("/vshop/SendRedEnvelope.aspx", false); } } }
private DataGridViewModel <Dictionary <string, object> > GetDataList(RedEnvelopeGetRecordQuery query) { DataGridViewModel <Dictionary <string, object> > dataGridViewModel = new DataGridViewModel <Dictionary <string, object> >(); if (query != null) { PageModel <RedEnvelopeGetRecordInfo> redEnvelopeGetRecord = WeiXinRedEnvelopeProcessor.GetRedEnvelopeGetRecord(query); dataGridViewModel.rows = new List <Dictionary <string, object> >(); dataGridViewModel.total = redEnvelopeGetRecord.Total; foreach (RedEnvelopeGetRecordInfo model in redEnvelopeGetRecord.Models) { Dictionary <string, object> dictionary = model.ToDictionary(); string text = ""; WeiXinRedEnvelopeInfo weiXinRedEnvelope = WeiXinRedEnvelopeProcessor.GetWeiXinRedEnvelope(model.RedEnvelopeId); text = ((weiXinRedEnvelope == null) ? "未知" : weiXinRedEnvelope.Name); dictionary.Add("RedEnvelopeName", text); dataGridViewModel.rows.Add(dictionary); } } return(dataGridViewModel); }
public bool CheckeGetWeiXinRedEnvelope(WeiXinRedEnvelopeInfo weiXinRedEnvelope) { WeiXinRedEnvelopeInfo openedWeiXinRedEnvelope = WeiXinRedEnvelopeProcessor.GetOpenedWeiXinRedEnvelope(); if (openedWeiXinRedEnvelope != null) { this.ShowMsg("已经存在正在进行中的活动,不能再次添加!", false); return(false); } Regex regex = new Regex("^([1-9]\\d*\\.\\d*|0\\.\\d*[1-9]\\d*)|([1-9]\\d*)$"); weiXinRedEnvelope.Name = this.txtName.Text.Trim(); if (string.IsNullOrEmpty(weiXinRedEnvelope.Name)) { this.ShowMsg("代金红包名称不能为空", false); return(false); } if (weiXinRedEnvelope.Name.Length > 64) { this.ShowMsg("代金红包名称不能超过64个字", false); return(false); } Regex regex2 = new Regex("^[1-9]\\d*$"); if (!regex2.IsMatch(this.txtMaxNumber.Text.Trim())) { this.ShowMsg("单次分享可领个数必须是大于零的整数", false); return(false); } weiXinRedEnvelope.MaxNumber = Convert.ToInt32(this.txtMaxNumber.Text.Trim()); if (weiXinRedEnvelope.MaxNumber <= 0) { this.ShowMsg("单次分享可领个数必须大于零", false); return(false); } if (weiXinRedEnvelope.MaxNumber > 888) { this.ShowMsg("单次分享可领个数不能大于888个", false); return(false); } weiXinRedEnvelope.ActualNumber = 0; if (this.rdbTypeRandom.Checked) { weiXinRedEnvelope.Type = 0; if (string.IsNullOrEmpty(this.txtMinAmount.Text)) { this.ShowMsg("代金红包随机最少金额不能为空", false); return(false); } if (!regex.IsMatch(this.txtMinAmount.Text)) { this.ShowMsg("代金红包随机最少金额必须是有效的正数", false); return(false); } if (string.IsNullOrEmpty(this.txtMaxAmount.Text)) { this.ShowMsg("代金红包随机最大金额不能为空", false); return(false); } if (!regex.IsMatch(this.txtMaxAmount.Text)) { this.ShowMsg("代金红包随机最大金额必须是有效的正数", false); return(false); } weiXinRedEnvelope.MinAmount = Convert.ToDecimal(this.txtMinAmount.Text); weiXinRedEnvelope.MaxAmount = Convert.ToDecimal(this.txtMaxAmount.Text); if (weiXinRedEnvelope.MinAmount <= decimal.Zero) { this.ShowMsg("代金红包随机最少金额必须大于零", false); return(false); } if (weiXinRedEnvelope.MaxAmount < weiXinRedEnvelope.MinAmount) { this.ShowMsg("代金红包随机最大金额必须大于最少金额", false); return(false); } } else if (this.rdbTypeFixed.Checked) { weiXinRedEnvelope.Type = 1; if (!regex.IsMatch(this.txtAmountFixed.Text)) { this.ShowMsg("代金红包固定金额必须是有效的正数", false); return(false); } decimal num3 = weiXinRedEnvelope.MinAmount = (weiXinRedEnvelope.MaxAmount = Convert.ToDecimal(this.txtAmountFixed.Text.Trim())); if (weiXinRedEnvelope.MinAmount <= decimal.Zero) { this.ShowMsg("代金红包固定金额必须大于零", false); return(false); } } if (this.rdbUnlimited.Checked) { weiXinRedEnvelope.EnableUseMinAmount = decimal.Zero; } else if (this.rdbSatisfy.Checked) { if (!regex.IsMatch(this.txtEnableUseMinAmount.Text)) { this.ShowMsg("使用条件金额必须是有效的正数", false); return(false); } weiXinRedEnvelope.EnableUseMinAmount = Convert.ToDecimal(this.txtEnableUseMinAmount.Text.Trim()); if (weiXinRedEnvelope.EnableUseMinAmount <= decimal.Zero) { this.ShowMsg("使用条件金额不能少于零", false); return(false); } } if (!regex.IsMatch(this.txtEnableIssueMinAmount.Text)) { this.ShowMsg("代金红包发放条件金额必须是有效的正数", false); return(false); } weiXinRedEnvelope.EnableIssueMinAmount = Convert.ToDecimal(this.txtEnableIssueMinAmount.Text.Trim()); if (weiXinRedEnvelope.EnableIssueMinAmount <= decimal.Zero) { this.ShowMsg("代金红包发放条件必须大于零", false); return(false); } if (string.IsNullOrEmpty(this.txtActiveStartTime.Text.Trim())) { this.ShowMsg("代金红包活动开始时间不能为空", false); return(false); } if (string.IsNullOrEmpty(this.txtActiveEndTime.Text.Trim())) { this.ShowMsg("代金红包活动结束时间不能为空", false); return(false); } weiXinRedEnvelope.ActiveStartTime = DateTime.Parse(this.txtActiveStartTime.Text.Trim() + " 00:00:00"); weiXinRedEnvelope.ActiveEndTime = DateTime.Parse(this.txtActiveEndTime.Text.Trim() + " 23:59:59"); if (weiXinRedEnvelope.ActiveStartTime > weiXinRedEnvelope.ActiveEndTime) { this.ShowMsg("代金红包活动开始时间不能大于代金红包活动结束时间", false); return(false); } if (string.IsNullOrEmpty(this.txtEffectivePeriodStartTime.Text.Trim())) { this.ShowMsg("代金红包有效期的起始时间不能为空", false); return(false); } if (string.IsNullOrEmpty(this.txtEffectivePeriodEndTime.Text.Trim())) { this.ShowMsg("代金红包有效期的结束时间不能为空", false); return(false); } weiXinRedEnvelope.EffectivePeriodStartTime = DateTime.Parse(this.txtEffectivePeriodStartTime.Text.Trim() + " 00:00:00"); weiXinRedEnvelope.EffectivePeriodEndTime = DateTime.Parse(this.txtEffectivePeriodEndTime.Text.Trim() + " 23:59:59"); if (weiXinRedEnvelope.EffectivePeriodStartTime > weiXinRedEnvelope.EffectivePeriodEndTime) { this.ShowMsg("代金红包有效期的起始时间不能大于代金红包有效期的结束时间", false); return(false); } if (string.IsNullOrEmpty(this.hidUploadImages.Value)) { this.ShowMsg("分享图标不能为空", false); return(false); } weiXinRedEnvelope.ShareIcon = this.hidUploadImages.Value; weiXinRedEnvelope.ShareTitle = this.txtShareTitle.Text.Trim(); if (string.IsNullOrEmpty(weiXinRedEnvelope.ShareTitle)) { this.ShowMsg("代金红包在微信中的分享标题不能为空", false); return(false); } if (weiXinRedEnvelope.ShareTitle.Length > 256) { this.ShowMsg("代金红包分享详情不能超过256个字", false); return(false); } weiXinRedEnvelope.ShareDetails = this.txtShareDetails.Text.Trim(); if (string.IsNullOrEmpty(weiXinRedEnvelope.ShareDetails)) { this.ShowMsg("代金红包在微信中的分享详情不能为空", false); return(false); } if (weiXinRedEnvelope.ShareDetails.Length > 1024) { this.ShowMsg("代金红包分享详情不能超过1024个字", false); return(false); } weiXinRedEnvelope.CreateTime = DateTime.Now; weiXinRedEnvelope.State = 1; return(true); }
protected void Page_Load(object sender, EventArgs e) { int id = this.Page.Request["RedEnvelopeId"].ToInt(0); WeiXinRedEnvelopeInfo weiXinRedEnvelope = WeiXinRedEnvelopeProcessor.GetWeiXinRedEnvelope(id); Dictionary <string, object> calendarParameter = this.txtActiveStartTime.CalendarParameter; DateTime dateTime = DateTime.Now; calendarParameter.Add("startDate", dateTime.ToString("yyyy-MM-dd")); Dictionary <string, object> calendarParameter2 = this.txtActiveEndTime.CalendarParameter; dateTime = DateTime.Now; calendarParameter2.Add("startDate", dateTime.ToString("yyyy-MM-dd")); Dictionary <string, object> calendarParameter3 = this.txtEffectivePeriodStartTime.CalendarParameter; dateTime = DateTime.Now; calendarParameter3.Add("startDate", dateTime.ToString("yyyy-MM-dd")); Dictionary <string, object> calendarParameter4 = this.txtEffectivePeriodEndTime.CalendarParameter; dateTime = DateTime.Now; calendarParameter4.Add("startDate", dateTime.ToString("yyyy-MM-dd")); if (weiXinRedEnvelope == null) { base.GotoResourceNotFound(); } else { CalendarPanel calendarPanel = this.txtActiveEndTime; dateTime = weiXinRedEnvelope.ActiveEndTime; calendarPanel.Text = dateTime.ToString("yyyy-MM-dd"); CalendarPanel calendarPanel2 = this.txtActiveStartTime; dateTime = weiXinRedEnvelope.ActiveStartTime; calendarPanel2.Text = dateTime.ToString("yyyy-MM-dd"); CalendarPanel calendarPanel3 = this.txtEffectivePeriodEndTime; dateTime = weiXinRedEnvelope.EffectivePeriodEndTime; calendarPanel3.Text = dateTime.ToString("yyyy-MM-dd"); CalendarPanel calendarPanel4 = this.txtEffectivePeriodStartTime; dateTime = weiXinRedEnvelope.EffectivePeriodStartTime; calendarPanel4.Text = dateTime.ToString("yyyy-MM-dd"); this.txtEnableIssueMinAmount.Text = weiXinRedEnvelope.EnableIssueMinAmount.F2ToString("f2"); this.txtEnableUseMinAmount.Text = weiXinRedEnvelope.EnableUseMinAmount.F2ToString("f2"); this.txtMaxAmount.Text = weiXinRedEnvelope.MaxAmount.F2ToString("f2"); this.txtMaxNumber.Text = weiXinRedEnvelope.MaxNumber.F2ToString("f2"); this.txtName.Text = weiXinRedEnvelope.Name; this.txtShareDetails.Text = weiXinRedEnvelope.ShareDetails; this.txtShareTitle.Text = weiXinRedEnvelope.ShareTitle; if (weiXinRedEnvelope.EnableUseMinAmount > decimal.Zero) { this.rdbSatisfy.Checked = true; this.rdbUnlimited.Checked = false; } else { this.divSatisfy.Visible = false; this.rdbSatisfy.Checked = false; this.rdbUnlimited.Checked = true; } if (weiXinRedEnvelope.Type == 1.GetHashCode()) { this.random.Visible = false; this.one.Visible = true; this.rdbTypeFixed.Checked = true; this.rdbTypeRandom.Checked = false; this.txtAmountFixed.Text = weiXinRedEnvelope.MinAmount.F2ToString("f2"); } else { this.random.Visible = true; this.one.Visible = false; this.rdbTypeFixed.Checked = false; this.rdbTypeRandom.Checked = true; this.txtMinAmount.Text = weiXinRedEnvelope.MinAmount.F2ToString("f2"); this.txtMaxAmount.Text = weiXinRedEnvelope.MaxAmount.F2ToString("f2"); } } }
private void rptOrders_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { HtmlAnchor htmlAnchor = (HtmlAnchor)e.Item.FindControl("lkbtnCouponCode"); HtmlAnchor htmlAnchor2 = (HtmlAnchor)e.Item.FindControl("lkbtnApplyForRefund"); HtmlAnchor htmlAnchor3 = (HtmlAnchor)e.Item.FindControl("lnkClose"); HtmlAnchor htmlAnchor4 = (HtmlAnchor)e.Item.FindControl("lkbtnViewMessage"); HtmlAnchor htmlAnchor5 = (HtmlAnchor)e.Item.FindControl("lkbtnProductReview"); Literal literal = (Literal)e.Item.FindControl("ltlOrderItems"); Literal literal2 = (Literal)e.Item.FindControl("ltlOrderGifts"); HtmlGenericControl htmlGenericControl = e.Item.FindControl("panelOperaters") as HtmlGenericControl; HtmlGenericControl htmlGenericControl2 = e.Item.FindControl("divToDetail") as HtmlGenericControl; HtmlGenericControl htmlGenericControl3 = e.Item.FindControl("divOrderStatus") as HtmlGenericControl; HtmlGenericControl htmlGenericControl4 = e.Item.FindControl("divOrderError") as HtmlGenericControl; HtmlGenericControl htmlGenericControl5 = e.Item.FindControl("divOrderGifts") as HtmlGenericControl; HtmlGenericControl htmlGenericControl6 = e.Item.FindControl("divOrderItems") as HtmlGenericControl; HtmlGenericControl htmlGenericControl7 = (HtmlGenericControl)e.Item.FindControl("OrderIdSpan"); HtmlGenericControl htmlGenericControl8 = (HtmlGenericControl)e.Item.FindControl("PayMoneySpan"); HtmlGenericControl htmlGenericControl9 = (HtmlGenericControl)e.Item.FindControl("TakeCodeDIV"); HtmlAnchor htmlAnchor6 = (HtmlAnchor)e.Item.FindControl("lnkViewLogistics"); HtmlAnchor htmlAnchor7 = (HtmlAnchor)e.Item.FindControl("lnkToPay"); HtmlAnchor htmlAnchor8 = (HtmlAnchor)e.Item.FindControl("lnkHelpLink"); HtmlAnchor htmlAnchor9 = (HtmlAnchor)e.Item.FindControl("lnkFinishOrder"); HtmlAnchor htmlAnchor10 = (HtmlAnchor)e.Item.FindControl("lnkViewTakeCodeQRCode"); HtmlAnchor htmlAnchor11 = (HtmlAnchor)e.Item.FindControl("lnkCertification"); HtmlGenericControl htmlGenericControl10 = (HtmlGenericControl)e.Item.FindControl("divSendRedEnvelope"); OrderStatus orderStatus = (OrderStatus)DataBinder.Eval(e.Item.DataItem, "OrderStatus"); Repeater repeater = (Repeater)e.Item.FindControl("Repeater1"); Repeater repeater2 = (Repeater)e.Item.FindControl("rptPointGifts"); this.paymenttypeselect = (Common_WAPPaymentTypeSelect)this.FindControl("paymenttypeselect"); Literal literal3 = (Literal)e.Item.FindControl("litGiftTitle"); string text = DataBinder.Eval(e.Item.DataItem, "OrderId").ToString(); OrderInfo orderInfo = TradeHelper.GetOrderInfo(text); if (orderInfo != null) { if (orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid || orderInfo.OrderStatus == OrderStatus.Finished || orderInfo.OrderStatus == OrderStatus.WaitReview || orderInfo.OrderStatus == OrderStatus.History) { WeiXinRedEnvelopeInfo openedWeiXinRedEnvelope = WeiXinRedEnvelopeProcessor.GetOpenedWeiXinRedEnvelope(); bool visible = false; if (openedWeiXinRedEnvelope != null && openedWeiXinRedEnvelope.EnableIssueMinAmount <= orderInfo.GetPayTotal() && orderInfo.OrderDate >= openedWeiXinRedEnvelope.ActiveStartTime && orderInfo.OrderDate <= openedWeiXinRedEnvelope.ActiveEndTime) { visible = true; } if (htmlGenericControl10 != null) { htmlGenericControl10.Visible = visible; if (this.isVShop) { htmlGenericControl10.InnerHtml = "<a href=\"/vshop/SendRedEnvelope.aspx?OrderId=" + orderInfo.OrderId + "\"></a>"; } else { htmlGenericControl10.InnerHtml = ""; string text2 = Globals.HttpsFullPath("/vshop/SendRedEnvelope.aspx?OrderId=" + orderInfo.OrderId); htmlGenericControl10.Attributes.Add("onclick", string.Format("ShowMsg('{0}','{1}')", "代金红包请前往微信端领取!", "false")); } } } this.paymenttypeselect.ClientType = base.ClientType; htmlGenericControl4.Visible = (orderInfo.IsError && orderInfo.CloseReason != "订单已退款完成"); htmlGenericControl3.Visible = !orderInfo.IsError; htmlGenericControl5.Visible = (orderInfo.LineItems.Count() == 0); htmlGenericControl6.Visible = (orderInfo.LineItems.Count() > 0); htmlAnchor2.HRef = "ApplyRefund.aspx?OrderId=" + text; htmlAnchor.Visible = false; htmlAnchor.HRef = "MemberOrdersVCode?OrderId=" + text; HtmlGenericControl htmlGenericControl11 = (HtmlGenericControl)e.Item.FindControl("OrderSupplierH3"); string text3 = string.Empty; if (htmlGenericControl11 != null) { text3 = htmlGenericControl11.Attributes["class"]; text3 = ((!string.IsNullOrEmpty(text3)) ? text3.Replace(" ztitle", "").Replace("stitle", "") : ""); } if (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay || !(orderInfo.ParentOrderId == "-1") || !orderInfo.OrderId.Contains("P")) { if (HiContext.Current.SiteSettings.OpenMultStore && orderInfo.StoreId > 0 && !string.IsNullOrWhiteSpace(orderInfo.StoreName)) { htmlGenericControl7.InnerText = orderInfo.StoreName; text3 += " mtitle"; } else if (orderInfo.StoreId == 0 && HiContext.Current.SiteSettings.OpenSupplier && orderInfo.SupplierId > 0) { htmlGenericControl7.InnerText = orderInfo.ShipperName; text3 += " stitle"; } else { htmlGenericControl7.InnerText = "平台"; text3 += " ztitle"; } htmlGenericControl11.Attributes["class"] = text3; if (orderInfo.LineItems.Count <= 0) { literal3.Text = "(礼)"; } } else { htmlGenericControl7.InnerText = orderInfo.OrderId; htmlGenericControl11.Attributes["class"] = text3; } if (orderInfo.PreSaleId > 0) { htmlGenericControl8.InnerText = (orderInfo.Deposit + orderInfo.FinalPayment).F2ToString("f2"); } else { htmlGenericControl8.InnerText = Convert.ToDecimal(DataBinder.Eval(e.Item.DataItem, "OrderTotal")).F2ToString("f2"); } if (htmlGenericControl2 != null) { if (orderInfo.OrderType == OrderType.ServiceOrder) { htmlGenericControl2.Attributes.Add("onclick", "window.location.href='ServiceMemberOrderDetails.aspx?orderId=" + orderInfo.OrderId + "'"); } else { htmlGenericControl2.Attributes.Add("onclick", "window.location.href='MemberOrderDetails.aspx?orderId=" + orderInfo.OrderId + "'"); } } if (htmlAnchor6 != null) { if (orderInfo.OrderStatus == OrderStatus.SellerAlreadySent || orderInfo.OrderStatus == OrderStatus.Finished) { if (!string.IsNullOrEmpty(orderInfo.ExpressCompanyAbb) && !string.IsNullOrEmpty(orderInfo.ShipOrderNumber)) { htmlAnchor6.HRef = "MyLogistics.aspx?OrderId=" + text; } else if (orderInfo.ExpressCompanyName == "同城物流配送") { htmlAnchor6.HRef = "MyLogistics.aspx?OrderId=" + text; } else { htmlAnchor6.Visible = false; } } else { htmlAnchor6.Visible = false; } } if (htmlAnchor10 != null) { htmlAnchor10.HRef = "ViewQRCode.aspx?orderId=" + orderInfo.OrderId; } int num4; if (htmlAnchor5 != null && ((orderStatus == OrderStatus.Finished && orderInfo.LineItems.Count > 0) || (orderStatus == OrderStatus.Closed && orderInfo.OnlyReturnedCount == orderInfo.LineItems.Count && orderInfo.LineItems.Count > 0))) { htmlAnchor5.Visible = true; htmlAnchor5.HRef = "MemberSubmitProductReview.aspx?orderId=" + text; DataTable productReviewAll = ProductBrowser.GetProductReviewAll(text); LineItemInfo lineItemInfo = new LineItemInfo(); int num = 0; int num2 = 0; int num3 = 0; bool flag = false; foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems) { flag = false; lineItemInfo = lineItem.Value; for (int i = 0; i < productReviewAll.Rows.Count; i++) { num4 = lineItemInfo.ProductId; if (num4.ToString() == productReviewAll.Rows[i][0].ToString() && lineItemInfo.SkuId.ToString().Trim() == productReviewAll.Rows[i][1].ToString().Trim()) { flag = true; } } if (!flag) { num2++; } else { num3++; } } if (num + num2 == orderInfo.LineItems.Count) { htmlAnchor5.InnerText = "查看评论"; } else { SiteSettings masterSettings = SettingsManager.GetMasterSettings(); if (masterSettings != null) { if (masterSettings.ProductCommentPoint <= 0) { htmlAnchor5.InnerText = "评价"; } else { htmlAnchor5.InnerText = $"评价得{num3 * masterSettings.ProductCommentPoint}积分"; } } } } if (htmlAnchor3 != null && orderStatus == OrderStatus.WaitBuyerPay) { if (orderInfo.PreSaleId == 0 || (orderInfo.PreSaleId > 0 && !orderInfo.DepositDate.HasValue)) { htmlAnchor3.Visible = true; } htmlAnchor3.Attributes.Add("onclick", $"closeOrder('{text}')"); } DateTime dateTime; if (htmlAnchor7 != null) { if (orderStatus == OrderStatus.WaitBuyerPay && orderInfo.ItemStatus == OrderItemStatus.Nomarl && orderInfo.PaymentTypeId != -3 && orderInfo.Gateway != "hishop.plugins.payment.bankrequest" && orderInfo.Gateway != "hishop.plugins.payment.podrequest") { htmlAnchor7.Attributes.Add("IsServiceOrder", (orderInfo.OrderType == OrderType.ServiceOrder).ToString().ToLower()); if (orderInfo.PreSaleId > 0) { ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId); if (!orderInfo.DepositDate.HasValue) { htmlGenericControl8.InnerText = orderInfo.Deposit.F2ToString("f2"); (e.Item.FindControl("sptotal") as HtmlGenericControl).InnerText = "定金:¥"; if (productPreSaleInfo.PreSaleEndDate > DateTime.Now) { AttributeCollection attributes = htmlAnchor7.Attributes; num4 = orderInfo.PaymentTypeId; attributes.Add("PaymentTypeId", num4.ToString()); htmlAnchor7.Attributes.Add("OrderId", orderInfo.OrderId); htmlAnchor7.Attributes.Add("OrderTotal", orderInfo.Deposit.F2ToString("f2")); AttributeCollection attributes2 = htmlAnchor7.Attributes; num4 = orderInfo.FightGroupId; attributes2.Add("FightGroupId", num4.ToString()); } else { htmlAnchor7.Visible = false; (e.Item.FindControl("sptotal") as HtmlGenericControl).InnerText = "定金:¥"; } } else if (productPreSaleInfo.PaymentStartDate > DateTime.Now || productPreSaleInfo.PaymentEndDate < DateTime.Now) { (e.Item.FindControl("sptotal") as HtmlGenericControl).InnerText = "尾款:¥"; htmlGenericControl8.InnerText = orderInfo.FinalPayment.F2ToString("f2"); htmlAnchor7.Visible = false; htmlAnchor3.Visible = false; if (productPreSaleInfo.PaymentEndDate < DateTime.Now) { (e.Item.FindControl("sptotal") as HtmlGenericControl).InnerText = "尾款支付结束"; htmlGenericControl8.Visible = false; } } else { AttributeCollection attributes3 = htmlAnchor7.Attributes; num4 = orderInfo.PaymentTypeId; attributes3.Add("PaymentTypeId", num4.ToString()); htmlAnchor7.Attributes.Add("OrderId", orderInfo.OrderId); htmlAnchor7.Attributes.Add("OrderTotal", orderInfo.FinalPayment.F2ToString("f2")); AttributeCollection attributes4 = htmlAnchor7.Attributes; num4 = orderInfo.FightGroupId; attributes4.Add("FightGroupId", num4.ToString()); htmlGenericControl8.InnerText = orderInfo.FinalPayment.F2ToString("f2"); (e.Item.FindControl("sptotal") as HtmlGenericControl).InnerText = "尾款:¥"; htmlAnchor3.Visible = false; } } else { AttributeCollection attributes5 = htmlAnchor7.Attributes; num4 = orderInfo.PaymentTypeId; attributes5.Add("PaymentTypeId", num4.ToString()); htmlAnchor7.Attributes.Add("OrderId", orderInfo.OrderId); htmlAnchor7.Attributes.Add("OrderTotal", orderInfo.GetTotal(false).F2ToString("f2")); AttributeCollection attributes6 = htmlAnchor7.Attributes; num4 = orderInfo.FightGroupId; attributes6.Add("FightGroupId", num4.ToString()); if (HiContext.Current.SiteSettings.OpenMultStore && orderInfo.StoreId > 0 && !SettingsManager.GetMasterSettings().Store_IsOrderInClosingTime) { StoresInfo storeById = StoresHelper.GetStoreById(orderInfo.StoreId); dateTime = DateTime.Now; string str = dateTime.ToString("yyyy-MM-dd"); dateTime = storeById.OpenStartDate; DateTime value = (str + " " + dateTime.ToString("HH:mm")).ToDateTime().Value; dateTime = DateTime.Now; string str2 = dateTime.ToString("yyyy-MM-dd"); dateTime = storeById.OpenEndDate; DateTime dateTime2 = (str2 + " " + dateTime.ToString("HH:mm")).ToDateTime().Value; if (dateTime2 <= value) { dateTime2 = dateTime2.AddDays(1.0); } if (DateTime.Now < value || DateTime.Now > dateTime2) { htmlAnchor7.Attributes.Add("NeedNotInTimeTip", "1"); } } } } else { htmlAnchor7.Visible = false; } } if (htmlAnchor8 != null) { if (orderInfo.Gateway == "hishop.plugins.payment.bankrequest" && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay) { htmlAnchor8.HRef = "FinishOrder.aspx?OrderId=" + text + "&onlyHelp=true"; } else { htmlAnchor8.Visible = false; } } if (htmlAnchor9 != null) { if (orderInfo.OrderStatus == OrderStatus.SellerAlreadySent && orderInfo.ItemStatus == OrderItemStatus.Nomarl) { htmlAnchor9.Attributes.Add("onclick", $"FinishOrder('{text}','{orderInfo.PaymentType}',{orderInfo.LineItems.Count})"); } else { htmlAnchor9.Visible = false; } } if (htmlAnchor11 != null) { if (HiContext.Current.SiteSettings.IsOpenCertification && orderInfo.IDStatus == 0 && orderInfo.IsincludeCrossBorderGoods) { htmlAnchor11.Attributes.Add("orderId", orderInfo.OrderId); htmlAnchor11.Attributes.Add("onclick", "Certification(this)"); htmlAnchor11.Visible = true; } else { htmlAnchor11.Visible = false; } } if (literal != null) { Literal literal4 = literal; num4 = this.GetGoodsNum(orderInfo); literal4.Text = num4.ToString(); } if (literal2 != null) { Literal literal5 = literal2; num4 = this.GetGiftsNum(orderInfo); literal5.Text = num4.ToString(); } if (orderInfo.OrderType == OrderType.ServiceOrder) { Label label = (Label)e.Item.FindControl("OrderStatusLabel2"); IList <OrderVerificationItemInfo> orderVerificationItems = TradeHelper.GetOrderVerificationItems(orderInfo.OrderId); ServiceOrderStatus orderStatus2 = this.GetOrderStatus(orderInfo, orderVerificationItems); label.Text = ((Enum)(object)orderStatus2).ToDescription(); label.Visible = true; } else { OrderStatusLabel orderStatusLabel = (OrderStatusLabel)e.Item.FindControl("OrderStatusLabel1"); orderStatusLabel.OrderItemStatus = ((orderInfo.ItemStatus != 0) ? OrderItemStatus.HasReturnOrReplace : OrderItemStatus.Nomarl); orderStatusLabel.Gateway = orderInfo.Gateway; orderStatusLabel.OrderStatusCode = orderInfo.OrderStatus; orderStatusLabel.ShipmentModelId = orderInfo.ShippingModeId; orderStatusLabel.IsConfirm = orderInfo.IsConfirm; orderStatusLabel.ShipmentModelId = orderInfo.ShippingModeId; orderStatusLabel.PaymentTypeId = orderInfo.PaymentTypeId; orderStatusLabel.PreSaleId = orderInfo.PreSaleId; orderStatusLabel.DepositDate = orderInfo.DepositDate; orderStatusLabel.OrderType = orderInfo.OrderType; orderStatusLabel.ExpressCompanyName = orderInfo.ExpressCompanyName; orderStatusLabel.DadaStatus = orderInfo.DadaStatus; orderStatusLabel.Visible = true; } Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems; foreach (string key in lineItems.Keys) { lineItems[key].IsValid = (orderInfo.OrderType == OrderType.ServiceOrder); } repeater.DataSource = lineItems.Values; repeater.ItemDataBound += this.Repeater1_ItemDataBound; repeater.DataBind(); if (orderInfo.LineItems.Count == 0) { IEnumerable <OrderGiftInfo> enumerable = from a in orderInfo.Gifts where a.PromoteType == 0 || a.PromoteType == 15 select a; foreach (OrderGiftInfo item in enumerable) { item.NeedPoint = ((orderInfo.OrderType == OrderType.ServiceOrder) ? 1 : 0); } repeater2.DataSource = enumerable; repeater2.ItemDataBound += this.rptPointGifts_ItemDataBound; repeater2.DataBind(); } OrderItemStatus itemStatus = orderInfo.ItemStatus; DateTime obj; if (DataBinder.Eval(e.Item.DataItem, "FinishDate") != DBNull.Value) { obj = (DateTime)DataBinder.Eval(e.Item.DataItem, "FinishDate"); } else { dateTime = DateTime.Now; obj = dateTime.AddYears(-1); } DateTime dateTime3 = obj; string text4 = ""; if (DataBinder.Eval(e.Item.DataItem, "Gateway") != null && !(DataBinder.Eval(e.Item.DataItem, "Gateway") is DBNull)) { text4 = (string)DataBinder.Eval(e.Item.DataItem, "Gateway"); } RefundInfo refundInfo = TradeHelper.GetRefundInfo(text); if (htmlAnchor2 != null) { if (orderInfo.OrderType == OrderType.ServiceOrder) { htmlAnchor2.Visible = (orderStatus == OrderStatus.BuyerAlreadyPaid && orderInfo.ItemStatus == OrderItemStatus.Nomarl && orderInfo.LineItems.Count != 0); if (htmlAnchor2.Visible) { LineItemInfo value2 = orderInfo.LineItems.FirstOrDefault().Value; if (value2.IsRefund) { if (value2.IsOverRefund) { htmlAnchor2.Visible = true; } else if (value2.IsValid) { htmlAnchor2.Visible = true; } else if (DateTime.Now >= value2.ValidStartDate.Value && DateTime.Now <= value2.ValidEndDate.Value) { htmlAnchor2.Visible = true; } else { htmlAnchor2.Visible = false; } } else { htmlAnchor2.Visible = false; } } } else { htmlAnchor2.Visible = (orderStatus == OrderStatus.BuyerAlreadyPaid && orderInfo.ItemStatus == OrderItemStatus.Nomarl && orderInfo.LineItems.Count != 0 && orderInfo.GetPayTotal() > decimal.Zero); } } if (htmlAnchor != null) { htmlAnchor.Visible = (orderInfo.OrderType == OrderType.ServiceOrder && orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid); } SiteSettings masterSettings2 = SettingsManager.GetMasterSettings(); if (!string.IsNullOrEmpty(orderInfo.TakeCode) && (orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid || orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)) { htmlAnchor10.Visible = true; } if (!htmlAnchor2.Visible && !htmlAnchor4.Visible && !htmlAnchor10.Visible && !htmlAnchor6.Visible && !htmlAnchor3.Visible && !htmlAnchor7.Visible && !htmlAnchor8.Visible && !htmlAnchor9.Visible && !htmlAnchor5.Visible && !htmlAnchor.Visible) { htmlGenericControl.Visible = false; } if (orderInfo.FightGroupId > 0) { FightGroupInfo fightGroup = VShopHelper.GetFightGroup(orderInfo.FightGroupId); if (fightGroup != null) { htmlAnchor2.Visible = (fightGroup.Status != 0 && orderInfo.GetPayTotal() > decimal.Zero && (refundInfo == null || refundInfo.HandleStatus == RefundStatus.Refused) && orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid); } } } } }
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("listOrderItems") as Repeater; repeater.ItemDataBound += this.rptOrderProducts_ItemDataBound; Label label = e.Item.FindControl("lblSupplierName") as Label; HtmlGenericControl htmlGenericControl = (HtmlGenericControl)e.Item.FindControl("divSupplier"); HtmlGenericControl htmlGenericControl2 = (HtmlGenericControl)e.Item.FindControl("divSendRedEnvelope"); if (this.orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid || this.orderInfo.OrderStatus == OrderStatus.Finished || this.orderInfo.OrderStatus == OrderStatus.WaitReview || this.orderInfo.OrderStatus == OrderStatus.History) { WeiXinRedEnvelopeInfo openedWeiXinRedEnvelope = WeiXinRedEnvelopeProcessor.GetOpenedWeiXinRedEnvelope(); bool visible = false; if (openedWeiXinRedEnvelope != null && openedWeiXinRedEnvelope.EnableIssueMinAmount <= this.orderInfo.GetPayTotal() && this.orderInfo.OrderDate >= openedWeiXinRedEnvelope.ActiveStartTime && this.orderInfo.OrderDate <= openedWeiXinRedEnvelope.ActiveEndTime) { visible = true; } if (htmlGenericControl2 != null) { htmlGenericControl2.Visible = visible; if (base.ClientType == ClientType.VShop) { htmlGenericControl2.InnerHtml = "<a href=\"/vshop/SendRedEnvelope.aspx?OrderId=" + this.orderInfo.OrderId + "\"></a>"; } else { htmlGenericControl2.InnerHtml = "<a href=\"javascript:ShowMsg('代金红包请前往微信端领取!','false')\"></a>"; } } } if (repeater != null) { int supplierId = 0; int.TryParse(DataBinder.Eval(e.Item.DataItem, "SupplierId").ToString(), out supplierId); List <LineItemInfo> list = (from i in this.orderInfo.LineItems.Values where i.SupplierId == supplierId select i).ToList(); if (HiContext.Current.SiteSettings.OpenMultStore && this.orderInfo.StoreId > 0) { label.Text = this.orderInfo.StoreName; htmlGenericControl.Attributes["class"] = "mtitle"; } else if (HiContext.Current.SiteSettings.OpenSupplier && (from i in list where i.SupplierId > 0 select i).Count() > 0 && list.Count > 0) { label.Text = list[0].SupplierName; htmlGenericControl.Attributes["class"] = "stitle"; } else { label.Text = "平台"; htmlGenericControl.Attributes["class"] = "ztitle"; } repeater.DataSource = list; repeater.DataBind(); } }
public static bool AddWeiXinRedEnvelope(WeiXinRedEnvelopeInfo weiXinRedEnvelope) { return(new WeiXinRedEnvelopeDao().Add(weiXinRedEnvelope, null) > 0); }
protected void listOrders_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { OrderStatus orderStatus = (OrderStatus)DataBinder.Eval(e.Item.DataItem, "OrderStatus"); string text = DataBinder.Eval(e.Item.DataItem, "OrderId").ToString(); OrderInfo orderInfo = TradeHelper.GetOrderInfo(text); if (orderInfo != null) { if (orderInfo.PreSaleId > 0) { Literal literal = (Literal)e.Item.FindControl("litPresale"); literal.Text = "(预售)"; literal.Visible = true; } OrderItemStatus itemStatus = orderInfo.ItemStatus; DateTime dateTime = (DataBinder.Eval(e.Item.DataItem, "FinishDate") == DBNull.Value) ? DateTime.Now.AddYears(-1) : ((DateTime)DataBinder.Eval(e.Item.DataItem, "FinishDate")); string text2 = ""; if (DataBinder.Eval(e.Item.DataItem, "Gateway") != null && !(DataBinder.Eval(e.Item.DataItem, "Gateway") is DBNull)) { text2 = (string)DataBinder.Eval(e.Item.DataItem, "Gateway"); } HyperLink hyperLink = (HyperLink)e.Item.FindControl("hplinkorderreview"); HtmlAnchor htmlAnchor = (HtmlAnchor)e.Item.FindControl("hlinkPay"); ImageLinkButton imageLinkButton = (ImageLinkButton)e.Item.FindControl("lkbtnConfirmOrder"); ImageLinkButton imageLinkButton2 = (ImageLinkButton)e.Item.FindControl("lkbtnCloseOrder"); HtmlAnchor htmlAnchor2 = (HtmlAnchor)e.Item.FindControl("lkbtnApplyForRefund"); HtmlAnchor htmlAnchor3 = (HtmlAnchor)e.Item.FindControl("lkbtnUserRealNameVerify"); HyperLink hyperLink2 = (HyperLink)e.Item.FindControl("hlinkOrderDetails"); Repeater repeater = (Repeater)e.Item.FindControl("rpProduct"); Repeater repeater2 = (Repeater)e.Item.FindControl("rpGift"); Label label = (Label)e.Item.FindControl("Logistics"); HtmlAnchor htmlAnchor4 = (HtmlAnchor)e.Item.FindControl("lkbtnViewMessage"); HtmlAnchor htmlAnchor5 = (HtmlAnchor)e.Item.FindControl("lkbtnRefundDetail"); htmlAnchor2.Attributes.Add("OrderId", text); htmlAnchor2.Attributes.Add("SkuId", ""); htmlAnchor2.Attributes.Add("GateWay", text2); OrderStatusLabel orderStatusLabel = (OrderStatusLabel)e.Item.FindControl("lblOrderStatus"); Literal literal2 = (Literal)e.Item.FindControl("lblGiftTitle"); orderStatusLabel.order = orderInfo; if (orderInfo.LineItems.Count <= 0) { Literal literal3 = literal2; literal3.Text += "(礼)"; } if (hyperLink != null) { if (orderInfo.GetGiftQuantity() > 0 && orderInfo.LineItems.Count() == 0) { hyperLink.Visible = false; } else { HyperLink hyperLink3 = hyperLink; int visible; switch (orderStatus) { case OrderStatus.Closed: visible = ((orderInfo.OnlyReturnedCount == orderInfo.LineItems.Count) ? 1 : 0); break; default: visible = 0; break; case OrderStatus.Finished: visible = 1; break; } hyperLink3.Visible = ((byte)visible != 0); if (hyperLink.Visible) { DataTable productReviewAll = ProductBrowser.GetProductReviewAll(orderInfo.OrderId); LineItemInfo lineItemInfo = new LineItemInfo(); int num = 0; int num2 = 0; int num3 = 0; bool flag = false; foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems) { flag = false; lineItemInfo = lineItem.Value; for (int i = 0; i < productReviewAll.Rows.Count; i++) { if (lineItemInfo.ProductId.ToString() == productReviewAll.Rows[i][0].ToString() && lineItemInfo.SkuId.ToString().Trim() == productReviewAll.Rows[i][1].ToString().Trim()) { flag = true; } } if (!flag) { num2++; } else { num3++; } } if (num + num2 == orderInfo.LineItems.Count) { hyperLink.Text = "查看评论"; } else { SiteSettings masterSettings = SettingsManager.GetMasterSettings(); if (masterSettings != null) { if (masterSettings.ProductCommentPoint <= 0) { hyperLink.Text = "评价"; } else { hyperLink.Text = $"评价得{num3 * masterSettings.ProductCommentPoint}积分"; } } } } } } if (orderInfo.PreSaleId > 0) { FormatedMoneyLabel formatedMoneyLabel = (FormatedMoneyLabel)e.Item.FindControl("FormatedMoneyLabel2"); formatedMoneyLabel.Money = orderInfo.Deposit + orderInfo.FinalPayment; formatedMoneyLabel.Text = (orderInfo.Deposit + orderInfo.FinalPayment).F2ToString("f2"); if (orderStatus == OrderStatus.WaitBuyerPay && text2 != "hishop.plugins.payment.podrequest" && text2 != "hishop.plugins.payment.bankrequest" && orderInfo.PaymentTypeId != -3) { if (!orderInfo.DepositDate.HasValue) { htmlAnchor.Visible = true; } else if (orderInfo.DepositDate.HasValue) { ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId); if (productPreSaleInfo.PaymentStartDate <= DateTime.Now && DateTime.Now <= productPreSaleInfo.PaymentEndDate) { htmlAnchor.Visible = true; } else { htmlAnchor.Visible = false; } } else { htmlAnchor.Visible = false; } } else { htmlAnchor.Visible = false; } } else { htmlAnchor.Visible = (orderStatus == OrderStatus.WaitBuyerPay && text2 != "hishop.plugins.payment.podrequest" && text2 != "hishop.plugins.payment.bankrequest" && orderInfo.PaymentTypeId != -3); } imageLinkButton.Visible = (orderStatus == OrderStatus.SellerAlreadySent && itemStatus == OrderItemStatus.Nomarl); if (orderInfo.PreSaleId > 0) { imageLinkButton2.Visible = (orderStatus == OrderStatus.WaitBuyerPay && itemStatus == OrderItemStatus.Nomarl && !orderInfo.DepositDate.HasValue); } else { imageLinkButton2.Visible = (orderStatus == OrderStatus.WaitBuyerPay && itemStatus == OrderItemStatus.Nomarl); } RefundInfo refundInfo = TradeHelper.GetRefundInfo(text); htmlAnchor2.Visible = ((orderInfo.FightGroupId > 0 && VShopHelper.IsFightGroupCanRefund(orderInfo.FightGroupId) && orderInfo.IsCanRefund) || (orderInfo.FightGroupId <= 0 && orderInfo.IsCanRefund)); htmlAnchor3.Visible = (HiContext.Current.SiteSettings.IsOpenCertification && orderInfo.IDStatus == 0 && orderInfo.IsincludeCrossBorderGoods); if (htmlAnchor3.Visible) { htmlAnchor3.Attributes.Add("OrderId", text); } if (repeater != null && repeater2 != null) { repeater.ItemDataBound += this.listProduct_ItemDataBound; IList <NewLineItemInfo> list = new List <NewLineItemInfo>(); foreach (LineItemInfo value in orderInfo.LineItems.Values) { NewLineItemInfo newLineItemInfo = this.GetNewLineItemInfo(value, orderInfo.OrderId); list.Add(newLineItemInfo); } if (list == null || list.Count == 0) { repeater.Visible = false; DataTable dataTable = (DataTable)(repeater2.DataSource = TradeHelper.GetOrderGiftsThumbnailsUrl(((DataRowView)e.Item.DataItem).Row["OrderId"].ToString())); repeater2.DataBind(); repeater2.Visible = true; } else { repeater.DataSource = list; repeater.DataBind(); repeater2.Visible = false; repeater.Visible = true; } } if (refundInfo != null && orderInfo.ItemStatus == OrderItemStatus.Nomarl && (orderInfo.OrderStatus == OrderStatus.ApplyForRefund || orderInfo.OrderStatus == OrderStatus.RefundRefused || orderInfo.OrderStatus == OrderStatus.Closed)) { htmlAnchor5.HRef = "/user/UserRefundApplyDetails/" + refundInfo.RefundId; htmlAnchor5.Visible = true; } hyperLink2.NavigateUrl = "/user/OrderDetails/" + orderInfo.OrderId; if ((orderStatus == OrderStatus.SellerAlreadySent || orderStatus == OrderStatus.Finished) && !string.IsNullOrEmpty(orderInfo.ExpressCompanyAbb) && !string.IsNullOrEmpty(orderInfo.ShipOrderNumber) && orderInfo.ShippingModeId != -2) { label.Attributes.Add("action", "order"); label.Attributes.Add("orderId", text); label.Visible = true; } if (orderInfo.FightGroupId > 0) { FightGroupInfo fightGroup = VShopHelper.GetFightGroup(orderInfo.FightGroupId); htmlAnchor2.Visible = (fightGroup.Status != 0 && orderInfo.GetPayTotal() > decimal.Zero && (refundInfo == null || refundInfo.HandleStatus == RefundStatus.Refused) && orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid); } if (orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid || orderInfo.OrderStatus == OrderStatus.Finished || orderInfo.OrderStatus == OrderStatus.WaitReview || orderInfo.OrderStatus == OrderStatus.History) { WeiXinRedEnvelopeInfo openedWeiXinRedEnvelope = WeiXinRedEnvelopeProcessor.GetOpenedWeiXinRedEnvelope(); bool flag2 = false; if (openedWeiXinRedEnvelope != null && openedWeiXinRedEnvelope.EnableIssueMinAmount <= orderInfo.GetPayTotal() && orderInfo.OrderDate >= openedWeiXinRedEnvelope.ActiveStartTime && orderInfo.OrderDate <= openedWeiXinRedEnvelope.ActiveEndTime) { flag2 = true; } if (flag2) { Image image = (Image)e.Item.FindControl("imgRedEnvelope"); image.ImageUrl = "../../../../common/images/SendRedEnvelope.png"; image.Attributes.Add("class", "ztitle_RedEnvelope"); image.Attributes.Add("onclick", "GetRedEnvelope(" + orderInfo.OrderId + ")"); image.Visible = true; } } if (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay || !(orderInfo.ParentOrderId == "-1") || !orderInfo.OrderId.Contains("P")) { Label label2 = (Label)e.Item.FindControl("lblsupplier"); if (label2 != null) { string empty = string.Empty; if (HiContext.Current.SiteSettings.OpenMultStore && orderInfo.StoreId > 0 && !string.IsNullOrWhiteSpace(orderInfo.StoreName)) { label2.Text = orderInfo.StoreName; empty = "mtitle_1"; } else if (orderInfo.StoreId == 0 && HiContext.Current.SiteSettings.OpenSupplier && orderInfo.SupplierId > 0) { label2.Text = orderInfo.ShipperName; empty = "stitle_1"; } else { label2.Text = "平台"; empty = "ztitle_1_new"; } label2.Attributes.Add("style", string.IsNullOrWhiteSpace(label2.Text) ? "display:none" : "display:inline"); label2.Attributes.Add("class", empty); label2.Visible = true; } } } } }
private void BindOrderInfo() { if (this.order.BalanceAmount > decimal.Zero) { this.litBalanceAmount.Text = this.order.BalanceAmount.F2ToString("f2"); } else { this.liBalanceAmount.Visible = false; } SiteSettings masterSettings = SettingsManager.GetMasterSettings(); DateTime? nullable; DateTime dateTime; if (this.order.PreSaleId > 0) { this.litDeposit.Text = this.order.Deposit.F2ToString("f2"); this.litFinal.Text = this.order.FinalPayment.F2ToString("f2"); nullable = this.order.DepositDate; if (nullable.HasValue) { Literal literal = this.litDepositDate; nullable = this.order.DepositDate; literal.Text = nullable.ToString(); } DateTime payDate = this.order.PayDate; if (this.order.PayDate != DateTime.MinValue) { Literal literal2 = this.litFinalDate; dateTime = this.order.PayDate; literal2.Text = dateTime.ToString(); } } if (this.order.ShippingModeId == -2) { this.divStoreAddress.Visible = true; this.divLogists.Visible = false; this.divShipAddress.Visible = false; } else { this.divStoreAddress.Visible = false; this.divLogists.Visible = (this.order.OrderStatus == OrderStatus.SellerAlreadySent || this.order.OrderStatus == OrderStatus.Finished); this.divShipAddress.Visible = true; } if (this.order.OrderStatus == OrderStatus.SellerAlreadySent && this.order.ItemStatus == OrderItemStatus.Nomarl) { this.ensureRecieved.Visible = true; } else { this.ensureRecieved.Visible = false; } if ((this.order.OrderStatus == OrderStatus.SellerAlreadySent || this.order.OrderStatus == OrderStatus.Finished) && !string.IsNullOrEmpty(this.order.ExpressCompanyAbb) && !string.IsNullOrEmpty(this.order.ShipOrderNumber)) { this.lookupTrans.Visible = true; this.lookupTrans.HRef = "MyLogistics.aspx?orderId=" + this.order.OrderId; } else { this.lookupTrans.Visible = false; } if (string.IsNullOrEmpty(this.order.TakeCode) || string.IsNullOrEmpty(masterSettings.HiPOSAppId) || this.order.OrderStatus == OrderStatus.Finished || this.order.OrderStatus == OrderStatus.Closed) { this.lookupQRCode.Visible = false; } ProductPreSaleInfo productPreSaleInfo = null; int paymentTypeId; if (this.order.OrderStatus == OrderStatus.WaitBuyerPay && this.order.Gateway != EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.CashOnDelivery, 1) && this.order.PaymentTypeId != -3) { if (this.order.PreSaleId > 0) { productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(this.order.PreSaleId); nullable = this.order.DepositDate; if (!nullable.HasValue) { if (productPreSaleInfo.PreSaleEndDate > DateTime.Now) { this.btnToPay.Visible = true; AttributeCollection attributes = this.btnToPay.Attributes; paymentTypeId = this.order.PaymentTypeId; attributes.Add("PaymentTypeId", paymentTypeId.ToString()); this.btnToPay.Attributes.Add("OrderId", this.orderId); this.btnToPay.Attributes.Add("orderTotal", (this.order.Deposit - this.order.BalanceAmount).F2ToString("f2")); } } else if (!(productPreSaleInfo.PaymentStartDate > DateTime.Now) && !(productPreSaleInfo.PaymentEndDate < DateTime.Now)) { this.btnToPay.Visible = true; AttributeCollection attributes2 = this.btnToPay.Attributes; paymentTypeId = this.order.PaymentTypeId; attributes2.Add("PaymentTypeId", paymentTypeId.ToString()); this.btnToPay.Attributes.Add("OrderId", this.orderId); this.btnToPay.Attributes.Add("orderTotal", this.order.FinalPayment.F2ToString("f2")); } } else { AttributeCollection attributes3 = this.btnToPay.Attributes; paymentTypeId = this.order.PaymentTypeId; attributes3.Add("PaymentTypeId", paymentTypeId.ToString()); this.btnToPay.Visible = true; this.btnToPay.Attributes.Add("OrderId", this.orderId); this.btnToPay.Attributes.Add("orderTotal", this.order.GetTotal(true).F2ToString("f2")); if (HiContext.Current.SiteSettings.OpenMultStore && this.order.StoreId > 0 && !SettingsManager.GetMasterSettings().Store_IsOrderInClosingTime) { StoresInfo storeById = StoresHelper.GetStoreById(this.order.StoreId); dateTime = DateTime.Now; string str = dateTime.ToString("yyyy-MM-dd"); dateTime = storeById.OpenStartDate; nullable = (str + " " + dateTime.ToString("HH:mm")).ToDateTime(); DateTime value = nullable.Value; dateTime = DateTime.Now; string str2 = dateTime.ToString("yyyy-MM-dd"); dateTime = storeById.OpenEndDate; nullable = (str2 + " " + dateTime.ToString("HH:mm")).ToDateTime(); DateTime dateTime2 = nullable.Value; if (dateTime2 <= value) { dateTime2 = dateTime2.AddDays(1.0); } if (DateTime.Now < value || DateTime.Now > dateTime2) { this.btnToPay.Attributes.Add("NeedNotInTimeTip", "1"); } } } if (this.order.Gateway == EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.OfflinePay, 1)) { this.btnToPay.InnerText = "线下支付帮助"; this.btnToPay.HRef = "FinishOrder.aspx?OrderId=" + this.order.OrderId + "&onlyHelp=true"; } } if (this.order.ReducedPromotionAmount <= decimal.Zero) { this.liFullReduction.Visible = false; } this.litShipTo.Text = this.order.ShipTo; this.litPhone.Text = this.order.CellPhone; this.litAddress.Text = this.order.ShippingRegion + this.order.Address; this.litOrderId.Text = this.orderId; Literal literal3 = this.litOrderDate; dateTime = this.order.OrderDate; literal3.Text = dateTime.ToString(); this.litTotalPrice.SetWhenIsNotNull(this.order.GetAmount(false).F2ToString("f2")); this.litOrderStatus.OrderStatusCode = this.order.OrderStatus; this.litOrderStatus.OrderItemStatus = this.order.ItemStatus; this.litOrderStatus.ShipmentModelId = this.order.ShippingModeId; this.litOrderStatus.IsConfirm = this.order.IsConfirm; this.litOrderStatus.Gateway = this.order.Gateway; this.litOrderStatus.PaymentTypeId = this.order.PaymentTypeId; this.litOrderStatus.PreSaleId = this.order.PreSaleId; this.litOrderStatus.DepositDate = this.order.DepositDate; Literal control = this.litPayTime; object value2; if (!(this.order.PayDate != DateTime.MinValue)) { value2 = ""; } else { dateTime = this.order.PayDate; value2 = dateTime.ToString("yyyy-MM-dd HH:mm:ss"); } control.SetWhenIsNotNull((string)value2); HtmlInputHidden control2 = this.orderStatus; paymentTypeId = (int)this.order.OrderStatus; control2.SetWhenIsNotNull(paymentTypeId.ToString()); this.hidOrderId.SetWhenIsNotNull(this.orderId.ToString()); this.litPaymentMode.SetWhenIsNotNull(this.order.PaymentType); this.litShipToDate.SetWhenIsNotNull(this.order.ShipToDate); bool flag = false; if (this.order.OrderStatus == OrderStatus.BuyerAlreadyPaid || this.order.OrderStatus == OrderStatus.Finished || this.order.OrderStatus == OrderStatus.WaitReview || this.order.OrderStatus == OrderStatus.History) { WeiXinRedEnvelopeInfo openedWeiXinRedEnvelope = WeiXinRedEnvelopeProcessor.GetOpenedWeiXinRedEnvelope(); if (openedWeiXinRedEnvelope != null && openedWeiXinRedEnvelope.EnableIssueMinAmount <= this.order.GetPayTotal() && this.order.OrderDate >= openedWeiXinRedEnvelope.ActiveStartTime && this.order.OrderDate <= openedWeiXinRedEnvelope.ActiveEndTime) { flag = true; } } this.hidShowRedEnvelope.SetWhenIsNotNull(flag ? "true" : "false"); if (this.order.PreSaleId > 0) { this.litBuildPrice.SetWhenIsNotNull((this.order.Deposit + this.order.FinalPayment).F2ToString("f2")); } else { this.litBuildPrice.SetWhenIsNotNull(this.order.GetPayTotal().F2ToString("f2")); } this.litRemark.SetWhenIsNotNull(this.order.Remark); this.litTakeCode.SetWhenIsNotNull((this.order.ShippingModeId == -2) ? this.order.TakeCode : ""); this.litFreight.SetWhenIsNotNull(this.order.AdjustedFreight.F2ToString("f2")); this.litFreight2.SetWhenIsNotNull(this.order.AdjustedFreight.F2ToString("f2")); this.giftFreight.Visible = (this.order.LineItems.Count == 0); this.litFullCapacityReduction.SetWhenIsNotNull("-" + this.order.ReducedPromotionAmount.F2ToString("f2")); if (this.order.PreSaleId > 0) { if (productPreSaleInfo == null) { productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(this.order.PreSaleId); } nullable = this.order.DepositDate; if (!nullable.HasValue) { this.hidpresaleStaut.Value = "1"; if (this.order.OrderStatus == OrderStatus.Closed) { this.hidpresaleStaut.Value = "6"; } } else if (productPreSaleInfo.PaymentStartDate > DateTime.Now) { this.hidpresaleStaut.Value = "2"; } else if (productPreSaleInfo.PaymentEndDate < DateTime.Now) { if (this.order.PayDate == DateTime.MinValue) { this.hidpresaleStaut.Value = "5"; } else { this.hidpresaleStaut.Value = "4"; } } else if (this.order.PayDate == DateTime.MinValue) { this.hidpresaleStaut.Value = "3"; } else { this.hidpresaleStaut.Value = "4"; } } }