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 (this.rdoName.Checked) { if (!string.IsNullOrEmpty(this.txtMemberNames.Text.Trim())) { IList <string> names = new List <string>(); string[] strArray = this.txtMemberNames.Text.Trim().Replace("\r\n", "\n").Replace("\n", "*").Split(new char[] { '*' }); for (int i = 0; i < strArray.Length; i++) { if (this.IsMembers(strArray[i])) { names.Add(strArray[i]); } } memdersByNames = SubsitePromoteHelper.GetMemdersByNames(names); } string claimCode = string.Empty; foreach (Member member in memdersByNames) { claimCode = Guid.NewGuid().ToString().Replace("-", "").Substring(0, 15); item = new CouponItemInfo(this.couponId, claimCode, new int?(member.UserId), member.Username, member.Email, DateTime.Now); listCouponItem.Add(item); } if (listCouponItem.Count <= 0) { this.ShowMsg("你输入的会员名中没有一个正确的,请输入正确的会员名", false); return; } SubsiteCouponHelper.SendClaimCodes(this.couponId, listCouponItem); this.txtMemberNames.Text = string.Empty; this.ShowMsg(string.Format("此次发送操作已成功,优惠券发送数量:{0}", listCouponItem.Count), true); } if (this.rdoRank.Checked) { memdersByNames = SubsitePromoteHelper.GetMembersByRank(this.rankList.SelectedValue); string str3 = string.Empty; foreach (Member member2 in memdersByNames) { str3 = Guid.NewGuid().ToString().Replace("-", "").Substring(0, 15); item = new CouponItemInfo(this.couponId, str3, new int?(member2.UserId), member2.Username, member2.Email, DateTime.Now); listCouponItem.Add(item); } if (listCouponItem.Count <= 0) { this.ShowMsg("您选择的会员等级下面没有会员", false); } else { SubsiteCouponHelper.SendClaimCodes(this.couponId, listCouponItem); this.txtMemberNames.Text = string.Empty; this.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++) { if (this.IsMembers(array[i])) { list3.Add(array[i]); } } list2 = SubsitePromoteHelper.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; } SubsiteCouponHelper.SendClaimCodes(this.couponId, list); this.txtMemberNames.Text = string.Empty; this.ShowMsg(string.Format("此次发送操作已成功,优惠券发送数量:{0}", list.Count), true); } if (this.rdoRank.Checked) { list2 = SubsitePromoteHelper.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; } SubsiteCouponHelper.SendClaimCodes(this.couponId, list); this.txtMemberNames.Text = string.Empty; this.ShowMsg(string.Format("此次发送操作已成功,优惠券发送数量:{0}", list.Count), true); } }