private void btnSend_Click(object sender, EventArgs e) { CouponItemInfo item = new CouponItemInfo(); IList <CouponItemInfo> listCouponItem = new List <CouponItemInfo>(); IList <Member> memdersByNames = new List <Member>(); if (rdoName.Checked) { if (!string.IsNullOrEmpty(txtMemberNames.Text.Trim())) { IList <string> names = new List <string>(); string[] strArray = txtMemberNames.Text.Trim().Replace("\r\n", "\n").Replace("\n", "*").Split(new char[] { '*' }); for (int i = 0; i < strArray.Length; i++) { if (IsMembers(strArray[i])) { names.Add(strArray[i]); } } memdersByNames = PromoteHelper.GetMemdersByNames(names); } string claimCode = string.Empty; foreach (Member member in memdersByNames) { claimCode = Guid.NewGuid().ToString().Replace("-", "").Substring(0, 15); item = new CouponItemInfo(couponId, claimCode, new int?(member.UserId), member.Email, DateTime.Now); listCouponItem.Add(item); } if (listCouponItem.Count <= 0) { ShowMsg("你输入的会员名中没有一个正确的,请输入正确的会员名", false); return; } CouponHelper.SendClaimCodes(couponId, listCouponItem); txtMemberNames.Text = string.Empty; ShowMsg(string.Format("此次发送操作已成功,优惠券发送数量:{0}", listCouponItem.Count), true); } if (rdoRank.Checked) { memdersByNames = PromoteHelper.GetMembersByRank(rankList.SelectedValue); string str2 = string.Empty; foreach (Member member2 in memdersByNames) { str2 = Guid.NewGuid().ToString().Replace("-", "").Substring(0, 15); item = new CouponItemInfo(couponId, str2, new int?(member2.UserId), member2.Email, DateTime.Now); listCouponItem.Add(item); } if (listCouponItem.Count <= 0) { ShowMsg("您选择的会员等级下面没有会员", false); } else { CouponHelper.SendClaimCodes(couponId, listCouponItem); txtMemberNames.Text = string.Empty; ShowMsg(string.Format("此次发送操作已成功,优惠券发送数量:{0}", listCouponItem.Count), true); } } }
private void btnSend_Click(object sender, System.EventArgs e) { CouponItemInfo item = new CouponItemInfo(); System.Collections.Generic.IList <CouponItemInfo> list = new System.Collections.Generic.List <CouponItemInfo>(); System.Collections.Generic.IList <Hidistro.Membership.Context.Member> list2 = new System.Collections.Generic.List <Hidistro.Membership.Context.Member>(); if (this.rdoName.Checked) { if (!string.IsNullOrEmpty(this.txtMemberNames.Text.Trim())) { System.Collections.Generic.IList <string> list3 = new System.Collections.Generic.List <string>(); string text = this.txtMemberNames.Text.Trim().Replace("\r\n", "\n"); string[] array = text.Replace("\n", "*").Split(new char[] { '*' }); for (int i = 0; i < array.Length; i++) { list3.Add(array[i]); } list2 = PromoteHelper.GetMemdersByNames(list3); } string claimCode = string.Empty; foreach (Hidistro.Membership.Context.Member current in list2) { claimCode = System.Guid.NewGuid().ToString().Replace("-", "").Substring(0, 15); item = new CouponItemInfo(this.couponId, claimCode, new int?(current.UserId), current.Username, current.Email, System.DateTime.Now); list.Add(item); } if (list.Count <= 0) { this.ShowMsg("你输入的会员名中没有一个正确的,请输入正确的会员名", false); return; } CouponHelper.SendClaimCodes(this.couponId, list); this.txtMemberNames.Text = string.Empty; this.ShowMsg(string.Format("此次发送操作已成功,优惠券发送数量:{0}", list.Count), true); } if (this.rdoRank.Checked) { list2 = PromoteHelper.GetMembersByRank(this.rankList.SelectedValue); string claimCode2 = string.Empty; foreach (Hidistro.Membership.Context.Member current2 in list2) { claimCode2 = System.Guid.NewGuid().ToString().Replace("-", "").Substring(0, 15); item = new CouponItemInfo(this.couponId, claimCode2, new int?(current2.UserId), current2.Username, current2.Email, System.DateTime.Now); list.Add(item); } if (list.Count <= 0) { this.ShowMsg("您选择的会员等级下面没有会员", false); return; } CouponHelper.SendClaimCodes(this.couponId, list); this.txtMemberNames.Text = string.Empty; this.ShowMsg(string.Format("此次发送操作已成功,优惠券发送数量:{0}", list.Count), true); } }
private void btnSend_Click(object sender, System.EventArgs e) { VoucherInfo voucherInfo = VoucherHelper.GetVoucher(voucherId); DateTime deadline = DateTime.Now.AddDays(voucherInfo.Validity); VoucherItemInfo item = new VoucherItemInfo(); System.Collections.Generic.IList <VoucherItemInfo> list = new System.Collections.Generic.List <VoucherItemInfo>(); System.Collections.Generic.IList <Member> list2 = new System.Collections.Generic.List <Member>(); if (this.rdoName.Checked) { if (!string.IsNullOrEmpty(this.txtMemberNames.Text.Trim())) { System.Collections.Generic.IList <string> list3 = new System.Collections.Generic.List <string>(); string text = this.txtMemberNames.Text.Trim().Replace("\r\n", "\n"); string[] array = text.Replace("\n", "*").Split(new char[] { '*' }); for (int i = 0; i < array.Length; i++) { list3.Add(array[i]); } list2 = PromoteHelper.GetMemdersByNames(list3); } string claimCode = string.Empty; string password = string.Empty; foreach (Member current in list2) { claimCode = System.Guid.NewGuid().ToString().Replace("-", "").Substring(0, 15); claimCode = Sign(claimCode, "UTF-8").Substring(8, 16); password = System.Guid.NewGuid().ToString().Replace("-", "").Substring(0, 15); item = new VoucherItemInfo(this.voucherId, claimCode, password, new int?(current.UserId), current.Username, current.Email, System.DateTime.Now, deadline); list.Add(item); } if (list.Count <= 0) { this.ShowMsg("你输入的会员名中没有一个正确的,请输入正确的会员名", false); return; } VoucherHelper.SendClaimCodes(list); this.txtMemberNames.Text = string.Empty; this.ShowMsg(string.Format("此次发送操作已成功,现金券发送数量:{0}", list.Count), true); } if (this.rdoRank.Checked) { StringBuilder strcondition = new StringBuilder(); strcondition.Append("1=1"); if (this.rankList.SelectedValue > 0) { strcondition.AppendFormat(" and GradeId={0} ", this.rankList.SelectedValue); } if (this.registerFromDate.SelectedDate.HasValue && this.registerToDate.SelectedDate.HasValue) { strcondition.AppendFormat(" and CreateDate>='{0}' and CreateDate<='{1}' ", this.registerFromDate.SelectedDate.Value, this.registerToDate.SelectedDate.Value); } if (this.ddlReggion.GetSelectedRegionId().HasValue) { strcondition.AppendFormat(" and TopRegionId={0} ", this.ddlReggion.GetSelectedRegionId().Value); } list2 = PromoteHelper.GetMembersByCondition(strcondition.ToString()); string claimCode2 = string.Empty; string password2 = string.Empty; foreach (Member current2 in list2) { claimCode2 = System.Guid.NewGuid().ToString().Replace("-", "").Substring(0, 15); claimCode2 = Sign(claimCode2, "UTF-8").Substring(8, 16); password2 = System.Guid.NewGuid().ToString().Replace("-", "").Substring(0, 15); item = new VoucherItemInfo(this.voucherId, claimCode2, password2, new int?(current2.UserId), current2.Username, current2.Email, System.DateTime.Now, deadline); list.Add(item); } if (list.Count <= 0) { this.ShowMsg("您选择的条件下面没有符合条件的会员", false); return; } VoucherHelper.SendClaimCodes(list); this.txtMemberNames.Text = string.Empty; this.ShowMsg(string.Format("此次发送操作已成功,现金券发送数量:{0}", list.Count), true); } }
private void btnSendToRank_Click(object sender, EventArgs e) { IList <Member> list = new List <Member>(); IList <SendMessageInfo> sendMessageList = new List <SendMessageInfo>(); IList <ReceiveMessageInfo> receiveMessageList = new List <ReceiveMessageInfo>(); if (rdoName.Checked) { if (string.IsNullOrEmpty(txtMemberNames.Text.Trim())) { ShowMsg("请输入您要发送的用户", false); return; } IList <string> names = new List <string>(); string[] strArray = txtMemberNames.Text.Trim().Replace("\r\n", "\n").Replace("\n", "*").Split(new char[] { '*' }); for (int i = 0; i < strArray.Length; i++) { if (IsMembers(strArray[i])) { names.Add(strArray[i]); } } foreach (Member member in PromoteHelper.GetMemdersByNames(names)) { SendMessageInfo item = new SendMessageInfo(); ReceiveMessageInfo info2 = new ReceiveMessageInfo(); item.Addressee = info2.Addressee = member.Username; item.Addresser = info2.Addresser = "admin"; item.Title = info2.Title = MessageTitle; item.PublishContent = info2.PublishContent = Content; sendMessageList.Add(item); receiveMessageList.Add(info2); } if (sendMessageList.Count <= 0) { ShowMsg("没有要发送的对象", false); return; } NoticeHelper.SendMessage(sendMessageList, receiveMessageList); ShowMsg(string.Format("成功给{0}个用户发送了消息.", sendMessageList.Count), true); } if (rdoRank.Checked) { foreach (Member member2 in PromoteHelper.GetMembersByRank(rankList.SelectedValue)) { SendMessageInfo info3 = new SendMessageInfo(); ReceiveMessageInfo info4 = new ReceiveMessageInfo(); info3.Addressee = info4.Addressee = member2.Username; info3.Addresser = info4.Addresser = "admin"; info3.Title = info4.Title = MessageTitle; info3.PublishContent = info4.PublishContent = Content; sendMessageList.Add(info3); receiveMessageList.Add(info4); } if (sendMessageList.Count > 0) { NoticeHelper.SendMessage(sendMessageList, receiveMessageList); ShowMsg(string.Format("成功给{0}个用户发送了消息.", sendMessageList.Count), true); } else { ShowMsg("没有要发送的对象", false); } } }