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