コード例 #1
0
ファイル: Default.aspx.cs プロジェクト: hafizor/stgeorge
    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();

        }
    }
コード例 #2
0
ファイル: Register.aspx.cs プロジェクト: hafizor/stgeorge
    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");
        }
    }