public WSResponse GetRecipientCount(long MyUserId) { FanfareRepository repository = new FanfareRepository(); int result = repository.CurrentShareCount(MyUserId); return new WSResponse(1, result); }
public WSResponse AddRecipientCount(long MyUserId, long TheirUserId) { FanfareRepository repository = new FanfareRepository(); int result = repository.IncreaseShareCount(MyUserId, TheirUserId); return new WSResponse(1, result); }
protected void Page_Init(object sender, EventArgs e) { if (Request.QueryString["autosharewallpost"] != null && Request.QueryString["autosharewallpost"].ToString().ToLower().Equals("true")) { CalculatedAutoSharePost = true; } if (Session["ie6alert"] == null && Request.Browser.IsBrowser("ie") && Request.Browser.MajorVersion == 6) { ShowOnceOnly.Visible = true; Session["ie6alert"] = true; } FacebookWebContext fbWebContext = FacebookFanfare.FaceBookHelper.GetFBSession(); if (fbWebContext.UserId > 0) { ActiveFaceBookUserID = fbWebContext.UserId.ToString(); FanfareRepository repository = new FanfareRepository(); decimal amount = repository.HasWonPrize(fbWebContext.UserId); if (amount > 0) { CurrentPrizeWon = amount; } DataTable entrant = repository.GetEntrant(fbWebContext.UserId); if (entrant.Rows.Count > 0) { CurrentEntrantFirstName = entrant.Rows[0]["UserFirstName"].ToString(); } TotalPrizesAwarded = repository.TotalPrizeWin(); } }
protected void Page_Load(object sender, EventArgs e) { FanfareRepository repository = new FanfareRepository(); FacebookWebContext context = FaceBookHelper.GetFBSession(); if (FaceBookHelper.IsCurrentPageLike()) { if(FaceBookHelper.IsAuthorised() && FaceBookHelper.IsPromotionPostLaunch()) { if (repository.HasWonPrize(context.UserId) > 0) { Server.Transfer("Result.aspx"); } } // Only do logic if the promotion is active. if (FaceBookHelper.IsPromotionActive() && FaceBookHelper.IsAuthorised()) { if (repository.HasWonPrize(context.UserId) > 0) { Server.Transfer("Result.aspx"); } if (repository.HasEnteredComp(context.UserId)) { if (repository.CurrentShareCount(context.UserId) >= 5) { Server.Transfer("SharesDone.aspx"); } Server.Transfer("Share.aspx"); } if (FaceBookHelper.IsAuthorised()) { Server.Transfer("Register.aspx"); } } } if (FaceBookHelper.IsPromotionActive()) { BindEntrants(); BindWinners(); } }
protected void Page_Load(object sender, EventArgs e) { FanfareRepository fanfareRepository = new FanfareRepository(); BindEntrants(); BindWinners(); decimal prizewin = fanfareRepository.TotalPrizeWin(); if (prizewin == decimal.Zero) { prizeLabel.Visible = false; noprizeLabel.Visible = true; } totalWinLabel.Text = prizewin.ToString("C"); }
protected void Page_Load(object sender, EventArgs e) { FanfareRepository repository = new FanfareRepository(); FacebookWebContext context = FaceBookHelper.GetFBSession(); decimal amount = repository.HasWonPrize(context.UserId); if (amount > 0) { prizeLabel.Text = amount.ToString("C"); } DataTable entrant = repository.GetEntrant(context.UserId); if (entrant.Rows.Count > 0) { userLabel.Text = entrant.Rows[0]["UserFirstName"].ToString(); } }
private void BindWinners() { FanfareRepository fanfareRepository = new FanfareRepository(); DataTable results = fanfareRepository.GetLatestWinners(); if (results.Rows.Count > 0) { winnersRepeater.DataSource = results; winnersRepeater.DataBind(); } else { winnersTableDiv.Visible = false; } }
protected void enterNowOnClick(object sender, EventArgs e) { FacebookWebContext fbcontext = FaceBookHelper.GetFBSession(); FanfareRepository repository = new FanfareRepository(); // double check that this user has already entered into the competition if (repository.HasEnteredComp(fbcontext.UserId)) { Server.Transfer("Share.aspx?autosharewallpost=true"); } int result = repository.AddEntrant(fbcontext.UserId, EmailHtmlInputText.Value, //"me["email"].ToString(), string.Format("{0} {1}", FirstNameHtmlInputText.Value, LastNameHtmlInputText.Value), //"me["name"].ToString(), FirstNameHtmlInputText.Value, //me["first_name"].ToString(), LastNameHtmlInputText.Value, //me["last_name"].ToString(), LocaleHiddenText.Value, //me["locale"].ToString(), GenderHiddenText.Value, //me["gender"].ToString(), FirstNameHtmlInputText.Value, LastNameHtmlInputText.Value, EmailHtmlInputText.Value, AddressOneHtmlInputText.Value, AddressTwoHtmlInputText.Value, SuburbHtmlInputText.Value, PostcodeHtmlInputText.Value, BestThingHtmlTextarea.Value, VicResidentHtmlInputCheckbox.Checked, StayUpdateHtmlInputCheckbox.Checked); if (result > 0) { PageHelpers.SendEntrantEmail(fbcontext.UserId, EmailHtmlInputText.Value, //"me["email"].ToString(), string.Format("{0} {1}", FirstNameHtmlInputText.Value, LastNameHtmlInputText.Value), //"me["name"].ToString(), FirstNameHtmlInputText.Value, //me["first_name"].ToString(), LastNameHtmlInputText.Value, //me["last_name"].ToString(), LocaleHiddenText.Value, //me["locale"].ToString(), GenderHiddenText.Value, //me["gender"].ToString(), FirstNameHtmlInputText.Value, LastNameHtmlInputText.Value, EmailHtmlInputText.Value, AddressOneHtmlInputText.Value, AddressTwoHtmlInputText.Value, SuburbHtmlInputText.Value, PostcodeHtmlInputText.Value, BestThingHtmlTextarea.Value, VicResidentHtmlInputCheckbox.Checked, StayUpdateHtmlInputCheckbox.Checked); Server.Transfer("Share.aspx?autosharewallpost=true"); } }
private void BindEntrants() { FanfareRepository fanfareRepository = new FanfareRepository(); topEntrantsRepeater.DataSource = fanfareRepository.GetLatestFans(); topEntrantsRepeater.DataBind(); }