protected override void AttachChildControls() { int num = default(int); int.TryParse(HttpContext.Current.Request.QueryString.Get("id"), out num); MemberInfo user = HiContext.Current.User; if (user.UserId == 0) { HttpContext.Current.Response.Redirect("login.aspx?ReturnUrl=/Vshop/Activity.aspx?id=" + num); } else { VActivityInfo activity = VshopBrowser.GetActivity(num); if (activity == null) { this.Page.ClientScript.RegisterStartupScript(base.GetType(), "myscript", "<script>$(function(){alert_h(\"活动还未开始或者已经结束!\",function(){window.location.href=\"/vshop/default.aspx\";});});</script>"); } else if (activity.MaxValue <= VshopBrowser.GetUserPrizeCount(num)) { this.Page.ClientScript.RegisterStartupScript(base.GetType(), "myscript", "<script>$(function(){alert_h(\"报名人数已达到限制人数!\",function(){window.location.href=\"/vshop/default.aspx\";});});</script>"); } else { this.img = (HiImage)this.FindControl("img"); this.litDescription = (Literal)this.FindControl("litDescription"); this.img.ImageUrl = activity.PicUrl; this.litDescription.Text = activity.Description; PageTitle.AddSiteNameTitle("微报名"); } } }
protected override void Render(HtmlTextWriter writer) { int num; int.TryParse(HttpContext.Current.Request.QueryString.Get("id"), out num); ActivityInfo activity = VshopBrowser.GetActivity(num); if (activity != null) { string format = "<div class=\"qb_mb10 qb_flex\"><input type=\"text\" class=\"mod_input flex_box\" style=\"height:35px;\" placeholder=\"您的{0}\" id=\"{1}\"></div>"; StringBuilder builder = new StringBuilder(); builder.AppendFormat("<input type=\"hidden\" id=\"id\" value=\"{0}\">", num); if (!string.IsNullOrEmpty(activity.Item1)) { builder.AppendFormat(format, activity.Item1, "item1"); } if (!string.IsNullOrEmpty(activity.Item2)) { builder.AppendFormat(format, activity.Item2, "item2"); } if (!string.IsNullOrEmpty(activity.Item3)) { builder.AppendFormat(format, activity.Item3, "item3"); } if (!string.IsNullOrEmpty(activity.Item4)) { builder.AppendFormat(format, activity.Item4, "item4"); } if (!string.IsNullOrEmpty(activity.Item5)) { builder.AppendFormat(format, activity.Item5, "item5"); } writer.Write(builder.ToString()); } }
protected override void AttachChildControls() { int num; int.TryParse(HttpContext.Current.Request.QueryString.Get("id"), out num); ActivityInfo activity = VshopBrowser.GetActivity(num); if (activity == null) { base.GotoResourceNotFound(""); } this.img = (HiImage)this.FindControl("img"); this.litDescription = (Literal)this.FindControl("litDescription"); this.img.ImageUrl = activity.PicUrl; this.litDescription.Text = activity.Description; PageTitle.AddSiteNameTitle("微报名"); }