protected override void AttachChildControls() { this.txtRealName = (TextBox)this.FindControl("txtRealName"); this.txtAddress = (TextBox)this.FindControl("txtAddress"); this.regionText = (HtmlInputHidden)this.FindControl("regionText"); this.region = (HtmlInputHidden)this.FindControl("region"); this.hdLink = (HiddenField)this.FindControl("hdLink"); this.txtEmail = (TextBox)this.FindControl("txtEmail"); this.txtPhone = (TextBox)this.FindControl("txtPhone"); this.hidValidateRealName = (HtmlInputHidden)this.FindControl("hidValidateRealName"); this.hidValidatePhone = (HtmlInputHidden)this.FindControl("hidValidatePhone"); this.hidValidateEmail = (HtmlInputHidden)this.FindControl("hidValidateEmail"); this.hidValidateAddress = (HtmlInputHidden)this.FindControl("hidValidateAddress"); this.hidIsPromoterValidatePhone = (HtmlInputHidden)this.FindControl("hidIsPromoterValidatePhone"); this.hdRegisterBecomePromoter = (HtmlInputHidden)this.FindControl("hdRegisterBecomePromoter"); this.hidOldBanner = (HtmlInputHidden)this.FindControl("hidOldBanner"); this.txtShopName = (TextBox)this.FindControl("txtShopName"); PageTitle.AddSiteNameTitle("分销员申请表单"); if (!this.Page.IsPostBack) { SiteSettings masterSettings = SettingsManager.GetMasterSettings(); if (masterSettings.RegisterBecomePromoter) { MemberInfo user = HiContext.Current.User; MemberProcessor.ReferralRequest(HiContext.Current.UserId, user.RealName, user.CellPhone, user.TopRegionId, user.RegionId, user.Address, user.Email, "", ""); this.hdRegisterBecomePromoter.Value = "/appshop/SplittinRule.aspx"; Users.ClearUserCache(HiContext.Current.UserId, ""); } else { string promoterNeedInfo = masterSettings.PromoterNeedInfo; MemberInfo user2 = Users.GetUser(); ReferralInfo referralInfo = Users.GetReferralInfo(HiContext.Current.UserId); if (referralInfo != null && referralInfo.ReferralStatus != 0 && this.Page.Request.QueryString["again"] != "1") { this.Page.Response.Redirect($"/{HiContext.Current.GetClientPath}/ReferralRegisterresults.aspx"); } ReferralExtInfo referralExtInfo = new ReferralExtInfo(); if (referralInfo != null) { this.txtShopName.Text = referralInfo.ShopName; this.hidOldBanner.Value = referralInfo.BannerUrl; referralExtInfo = MemberProcessor.GetReferralExtInfo(referralInfo.RequetReason); } this.hdLink.Value = Globals.FullPath("/appshop/ReferralRegisterresults.aspx"); string fullRegion = RegionHelper.GetFullRegion((referralExtInfo.RegionId > 0) ? referralExtInfo.RegionId : user2.RegionId, " ", true, 0); this.txtAddress.Text = (string.IsNullOrEmpty(referralExtInfo.Address) ? user2.Address : referralExtInfo.Address); this.txtRealName.Text = (string.IsNullOrEmpty(referralExtInfo.RealName) ? user2.RealName : referralExtInfo.RealName); this.txtEmail.Text = (string.IsNullOrEmpty(referralExtInfo.Email) ? user2.Email : referralExtInfo.Email); this.txtPhone.Text = (string.IsNullOrEmpty(referralExtInfo.CellPhone) ? user2.CellPhone : referralExtInfo.CellPhone); this.hidValidateRealName.Value = (promoterNeedInfo.Contains("1") ? "1" : ""); this.hidValidatePhone.Value = (promoterNeedInfo.Contains("2") ? "1" : ""); this.hidValidateEmail.Value = (promoterNeedInfo.Contains("3") ? "1" : ""); this.hidValidateAddress.Value = (promoterNeedInfo.Contains("4") ? "1" : ""); this.hidIsPromoterValidatePhone.Value = (masterSettings.IsPromoterValidatePhone ? "1" : ""); this.regionText.SetWhenIsNotNull(fullRegion); this.region.SetWhenIsNotNull(((referralExtInfo.RegionId > 0) ? referralExtInfo.RegionId : user2.RegionId).ToString()); } } }
protected override void AttachChildControls() { this.txtRealName = (TextBox)this.FindControl("txtRealName"); this.txtAddress = (TextBox)this.FindControl("txtAddress"); this.btnReferral = ButtonManager.Create(this.FindControl("btnReferral")); this.dropRegionsSelect = (RegionSelector)this.FindControl("dropRegions"); this.txtEmail = (TextBox)this.FindControl("txtEmail"); this.txtPhone = (TextBox)this.FindControl("txtPhone"); this.hidValidateRealName = (HtmlInputHidden)this.FindControl("hidValidateRealName"); this.hidValidatePhone = (HtmlInputHidden)this.FindControl("hidValidatePhone"); this.hidValidateEmail = (HtmlInputHidden)this.FindControl("hidValidateEmail"); this.hidValidateAddress = (HtmlInputHidden)this.FindControl("hidValidateAddress"); this.hidIsPromoterValidatePhone = (HtmlInputHidden)this.FindControl("hidIsPromoterValidatePhone"); this.txtPhoneCode = (TextBox)this.FindControl("txtPhoneCode"); this.txtNumber = (TextBox)this.FindControl("txtNumber"); this.txtShopName = (TextBox)this.FindControl("txtShopName"); this.btnReferral.Click += this.btnReferral_Click; PageTitle.AddSiteNameTitle("分销员申请表单"); if (!this.Page.IsPostBack) { MemberInfo user = HiContext.Current.User; ReferralInfo referralInfo = Users.GetReferralInfo(HiContext.Current.UserId); int referralUserId = user.ReferralUserId; int.TryParse(HttpContext.Current.Request.QueryString["ReferralUserId"], out referralUserId); if (referralInfo != null && referralInfo.ReferralStatus != 2 && referralInfo.ReferralStatus == 3 && this.Page.Request.QueryString["again"] != "1" && referralUserId <= 0) { this.Page.Response.Redirect("/user/ReferralRegisterresults.aspx", true); } if (user.IsReferral()) { this.Page.Response.Redirect("/user/PopularizeGift.aspx"); } ReferralExtInfo referralExtInfo = new ReferralExtInfo(); if (referralInfo != null) { referralExtInfo = MemberProcessor.GetReferralExtInfo(referralInfo.RequetReason); this.txtShopName.Text = referralInfo.ShopName; } string fullRegion = RegionHelper.GetFullRegion((referralExtInfo.RegionId > 0) ? referralExtInfo.RegionId : user.RegionId, " ", true, 0); this.txtAddress.Text = (string.IsNullOrEmpty(referralExtInfo.Address) ? user.Address : referralExtInfo.Address); this.txtRealName.Text = (string.IsNullOrEmpty(referralExtInfo.RealName) ? user.RealName : referralExtInfo.RealName); this.txtEmail.Text = (string.IsNullOrEmpty(referralExtInfo.Email) ? user.Email : referralExtInfo.Email); this.txtPhone.Text = (string.IsNullOrEmpty(referralExtInfo.CellPhone) ? user.CellPhone : referralExtInfo.CellPhone); this.dropRegionsSelect.SetSelectedRegionId(user.RegionId); SiteSettings masterSettings = SettingsManager.GetMasterSettings(); string promoterNeedInfo = masterSettings.PromoterNeedInfo; if (!string.IsNullOrEmpty(promoterNeedInfo)) { this.hidValidateRealName.Value = (promoterNeedInfo.Contains("1") ? "1" : ""); this.hidValidatePhone.Value = (promoterNeedInfo.Contains("2") ? "1" : ""); this.hidValidateEmail.Value = (promoterNeedInfo.Contains("3") ? "1" : ""); this.hidValidateAddress.Value = (promoterNeedInfo.Contains("4") ? "1" : ""); this.hidIsPromoterValidatePhone.Value = (masterSettings.IsPromoterValidatePhone ? "1" : ""); } } }
public void ExportToExcel(HttpContext context) { MemberQuery dataQuery = this.GetDataQuery(context); IList <Hidistro.Entities.Members.ReferralInfo> referralExportData = MemberHelper.GetReferralExportData(dataQuery); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("<table border='1'>"); stringBuilder.Append("<thead><tr>"); stringBuilder.Append("<th>分销员</th>"); stringBuilder.Append("<th>真实姓名</th>"); stringBuilder.Append("<th>电话号码</th>"); stringBuilder.Append("<th>邮箱</th>"); stringBuilder.Append("<th>店铺名称</th>"); stringBuilder.Append("<th>分销员等级</th>"); stringBuilder.Append("<th>直接下级数</th>"); stringBuilder.Append("<th>直接下级成交额</th>"); stringBuilder.Append("<th>累计获得佣金</th>"); stringBuilder.Append("<th>成为分销员时间</th>"); stringBuilder.Append("</tr></thead>"); StringBuilder stringBuilder2 = new StringBuilder(); DateTime dateTime; foreach (Hidistro.Entities.Members.ReferralInfo item in referralExportData) { ReferralExtInfo referralExtInfo = MemberProcessor.GetReferralExtInfo(item.RequetReason); stringBuilder2.Append("<tr>"); stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(item.UserName, true)); stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(string.IsNullOrEmpty(referralExtInfo.RealName) ? item.RealName : referralExtInfo.RealName, true)); stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(string.IsNullOrEmpty(referralExtInfo.CellPhone) ? item.CellPhone : referralExtInfo.CellPhone, true)); stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(string.IsNullOrEmpty(referralExtInfo.Email) ? item.Email : referralExtInfo.Email, true)); stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(item.ShopName, true)); stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(item.GradeName, true)); stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(item.SubNumber, false)); stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(item.LowerSaleTotal.F2ToString("f2"), false)); stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(item.UserAllSplittin.F2ToString("f2"), false)); StringBuilder stringBuilder3 = stringBuilder2; dateTime = item.AuditDate.Value; stringBuilder3.Append(ExcelHelper.GetXLSFieldsTD(dateTime.ToString("yyyy-MM-dd HH:mm:ss"), false)); stringBuilder2.Append("</tr>"); } stringBuilder.AppendFormat("<tbody>{0}</tbody></table>", stringBuilder2.ToString()); StringWriter stringWriter = new StringWriter(); stringWriter.Write(stringBuilder); HttpResponse response = context.Response; StringBuilder stringBuilder4 = stringWriter.GetStringBuilder(); dateTime = DateTime.Now; DownloadHelper.DownloadFile(response, stringBuilder4, "ReferralList_" + dateTime.ToString("yyyyMMddhhmmss") + ".xls"); stringWriter.Close(); context.Response.End(); }