protected override void AttachChildControls() { int num; int.TryParse(HttpContext.Current.Request.QueryString.Get("id"), out num); LotteryTicketInfo lotteryTicket = VshopBrowser.GetLotteryTicket(num); if (lotteryTicket == null) { base.GotoResourceNotFound(""); } if ((lotteryTicket != null) && VshopBrowser.HasSignUp(num, Globals.GetCurrentMemberUserId())) { HttpContext.Current.Response.Redirect(string.Format("~/vshop/ticket.aspx?id={0}", num)); } if ((lotteryTicket.StartTime > DateTime.Now) || (DateTime.Now > lotteryTicket.EndTime)) { this.Page.ClientScript.RegisterStartupScript(base.GetType(), "myscript", "<script>$(function(){hideSignUpBtn();alert_h(\"活动还未开始或者已经结束!\",function(){window.location.href=\"/vshop/default.aspx\";});});</script>"); } this.pnlInfo = (Panel) this.FindControl("pnlInfo"); this.litActivityDesc = (Literal) this.FindControl("litActivityDesc"); this.litPrizeNames = (Common_PrizeNames) this.FindControl("litPrizeNames"); this.litStartDate = (Literal) this.FindControl("litStartDate"); this.litEndDate = (Literal) this.FindControl("litEndDate"); this.pnlInfo.Visible = !string.IsNullOrEmpty(lotteryTicket.InvitationCode); this.litActivityDesc.Text = lotteryTicket.ActivityDesc; this.litPrizeNames.Activity = lotteryTicket; this.litStartDate.Text = lotteryTicket.OpenTime.ToString("yyyy年MM月dd日 HH:mm:ss"); this.litEndDate.Text = lotteryTicket.EndTime.ToString("yyyy年MM月dd日 HH:mm:ss"); PageTitle.AddSiteNameTitle("抽奖报名"); }
protected override void AttachChildControls() { if (!int.TryParse(this.Page.Request.QueryString["activityid"], out this.activityid)) { base.GotoResourceNotFound(""); } this.bgimg = (HtmlImage) this.FindControl("bgimg"); this.litActivityDesc = (Literal) this.FindControl("litActivityDesc"); this.litPrizeNames = (Common_PrizeNames) this.FindControl("litPrizeNames"); this.litPrizeUsers = (Common_PrizeUsers) this.FindControl("litPrizeUsers"); this.litStartDate = (Literal) this.FindControl("litStartDate"); this.litEndDate = (Literal) this.FindControl("litEndDate"); PageTitle.AddSiteNameTitle("砸金蛋"); LotteryActivityInfo lotteryActivity = VshopBrowser.GetLotteryActivity(this.activityid); if (lotteryActivity == null) { base.GotoResourceNotFound(""); } if (MemberProcessor.GetCurrentMember() == null) { MemberInfo member = new MemberInfo(); string generateId = Globals.GetGenerateId(); member.GradeId = MemberProcessor.GetDefaultMemberGrade(); member.UserName = ""; member.OpenId = ""; member.CreateDate = DateTime.Now; member.SessionId = generateId; member.SessionEndTime = DateTime.Now; MemberProcessor.CreateMember(member); member = MemberProcessor.GetMember(generateId); HttpCookie cookie = new HttpCookie("Vshop-Member") { Value = member.UserId.ToString(), Expires = DateTime.Now.AddYears(10) }; HttpContext.Current.Response.Cookies.Add(cookie); } this.litStartDate.Text = lotteryActivity.StartTime.ToString("yyyy年MM月dd日 HH:mm:ss"); this.litEndDate.Text = lotteryActivity.EndTime.ToString("yyyy年MM月dd日 HH:mm:ss"); if (VshopBrowser.GetUserPrizeCount(this.activityid) >= lotteryActivity.MaxNum) { this.Page.ClientScript.RegisterStartupScript(base.GetType(), "myscript", "<script>alert_h(\"亲,不好意思您的抽奖机会已经用完了哦,敬请期待下次活动吧!\",function(){window.location.href=\"/vshop/default.aspx\";});</script>"); } if ((lotteryActivity.StartTime < DateTime.Now) && (DateTime.Now < lotteryActivity.EndTime)) { this.litActivityDesc.Text = lotteryActivity.ActivityDesc; this.litPrizeNames.Activity = lotteryActivity; this.litPrizeUsers.Activity = lotteryActivity; int userPrizeCount = VshopBrowser.GetUserPrizeCount(this.activityid); this.litActivityDesc.Text = this.litActivityDesc.Text + string.Format("您一共有{0}次参与机会,目前还剩{1}次。", lotteryActivity.MaxNum, lotteryActivity.MaxNum - userPrizeCount); } else { this.Page.ClientScript.RegisterStartupScript(base.GetType(), "myscript", "<script>alert_h(\"活动还未开始或者已经结束!\",function(){window.location.href=\"/vshop/default.aspx\";})</script>"); } }
protected override void AttachChildControls() { int num; int.TryParse(HttpContext.Current.Request.QueryString.Get("id"), out num); LotteryTicketInfo lotteryTicket = VshopBrowser.GetLotteryTicket(num); if (lotteryTicket == null) { base.GotoResourceNotFound(""); } this.litActivityDesc = (Literal) this.FindControl("litActivityDesc"); this.litPrizeNames = (Common_PrizeNames) this.FindControl("litPrizeNames"); this.litStartDate = (Literal) this.FindControl("litStartDate"); this.litEndDate = (Literal) this.FindControl("litEndDate"); this.litActivityDesc.Text = lotteryTicket.ActivityDesc; this.litPrizeNames.Activity = lotteryTicket; this.litStartDate.Text = lotteryTicket.OpenTime.ToString("yyyy年MM月dd日 HH:mm:ss"); this.litEndDate.Text = lotteryTicket.EndTime.ToString("yyyy年MM月dd日 HH:mm:ss"); PageTitle.AddSiteNameTitle("微抽奖"); }
protected override void AttachChildControls() { if (!int.TryParse(this.Page.Request.QueryString["activityid"], out this.activityid)) { base.GotoResourceNotFound(""); } this.bgimg = (HtmlImage) this.FindControl("bgimg"); this.litActivityDesc = (Literal) this.FindControl("litActivityDesc"); this.litPrizeNames = (Common_PrizeNames) this.FindControl("litPrizeNames"); this.litPrizeUsers = (Common_PrizeUsers) this.FindControl("litPrizeUsers"); this.litStartDate = (Literal) this.FindControl("litStartDate"); this.litEndDate = (Literal) this.FindControl("litEndDate"); PageTitle.AddSiteNameTitle("刮刮卡"); LotteryActivityInfo lotteryActivity = VshopBrowser.GetLotteryActivity(this.activityid); if (lotteryActivity == null) { base.GotoResourceNotFound(""); } this.litStartDate.Text = lotteryActivity.StartTime.ToString("yyyy年MM月dd日 HH:mm:ss"); this.litEndDate.Text = lotteryActivity.EndTime.ToString("yyyy年MM月dd日 HH:mm:ss"); if (VshopBrowser.GetUserPrizeCount(this.activityid) >= lotteryActivity.MaxNum) { this.Page.ClientScript.RegisterStartupScript(base.GetType(), "myscript", "<script>$(function(){alert_h(\"亲,不好意思您的抽奖机会已经用完了哦,敬请期待下次活动吧!\",function(){window.location.href=\"/vshop/default.aspx\";});});</script>"); } if ((lotteryActivity.StartTime < DateTime.Now) && (DateTime.Now < lotteryActivity.EndTime)) { this.litActivityDesc.Text = lotteryActivity.ActivityDesc; this.litPrizeNames.Activity = lotteryActivity; this.litPrizeUsers.Activity = lotteryActivity; int userPrizeCount = VshopBrowser.GetUserPrizeCount(this.activityid); this.litActivityDesc.Text = this.litActivityDesc.Text + string.Format("您一共有{0}次参与机会,目前还剩{1}次。", lotteryActivity.MaxNum, lotteryActivity.MaxNum - userPrizeCount); } else { this.Page.ClientScript.RegisterStartupScript(base.GetType(), "scriptErro", "<script>$(function(){alert_h(\"活动还未开始或者已经结束!\",function(){window.location.href=\"/vshop/default.aspx\";});});</script>"); } }