Ejemplo n.º 1
0
        private void AcceptBet(int BetId, string TypeOfBet, Button But)
        {
            int Qstring;

            if (Request.QueryString["BetId"] != null && int.TryParse(Request.QueryString["BetId"], out Qstring))
            {
                Response.Write(Session["UserIdWhoCreated"].ToString());

                if (Session["UserId"] != null)
                {
                    if (Session["UserIdWhoCreated"] != null)
                    {
                        if (TypeOfBet == "PlayerBet")
                        {
                            UsersBets.UserAgreeToBet(Qstring, (int)Session["UserIdWhoCreated"], (int)Session["UserId"], false);
                        }
                        else
                        {
                            UsersBets.UserAgreeToBet(Qstring, (int)Session["UserIdWhoCreated"], (int)Session["UserId"], true);
                        }
                    }
                    else
                    {
                        throw new NotImplementedException();
                    }
                }
                else
                {
                    pnlMustBeLoggedId.Visible   = true;
                    ViewState["MustBeLoggedIn"] = true;
                }
            }
        }
Ejemplo n.º 2
0
        protected void btnAgreeWithBet_Click(object sender, EventArgs e)
        {
            int Qstring;

            if (Request.QueryString["BetId"] != null && int.TryParse(Request.QueryString["BetId"], out Qstring))
            {
                if (Session["UserId"] != null)
                {
                    UsersBets.UserBetApprovals(Qstring, (int)Session["UserId"]);

                    btnAgreeWithBet.Enabled = false;
                    btnAgreeWithBet.Attributes.CssStyle.Add("opacity", ".5");
                    btnAgreeWithBet.ToolTip = "Bet Is Already Agreed With";
                }
                else
                {
                    pnlMustBeLoggedId.Visible   = true;
                    ViewState["MustBeLoggedIn"] = true;
                }
            }
        }
Ejemplo n.º 3
0
        protected void btnCopyBet_Click(object sender, EventArgs e)
        {
            int QstringBetId;

            if (Request.QueryString["BetId"] != null && int.TryParse(Request.QueryString["BetId"], out QstringBetId))
            {
                if (Session["UserId"] != null)
                {
                    if (Request.QueryString["Type"] != null && Request.QueryString["Type"] == "PlayerBet")
                    {
                        if (rdoCopyBetSelection.SelectedIndex == 0)
                        {
                            UsersBets.MakeCopyOBet((int)Session["UserId"], QstringBetId, false, false);
                        }
                        else
                        {
                            UsersBets.MakeCopyOBet((int)Session["UserId"], QstringBetId, false, true);
                        }
                    }
                    else
                    {
                        if (rdoCopyBetSelection.SelectedIndex == 0)
                        {
                            UsersBets.MakeCopyOBet((int)Session["UserId"], QstringBetId, true, false);
                        }
                        else
                        {
                            UsersBets.MakeCopyOBet((int)Session["UserId"], QstringBetId, true, true);
                        }
                    }
                }
                else
                {
                    pnlMustBeLoggedId.Visible   = true;
                    ViewState["MustBeLoggedIn"] = true;
                }
            }
        }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.Page.IsPostBack)
            {
                HidePanels();

                if (Request.QueryString["BetId"] != null)
                {
                    int betId = Convert.ToInt32(Request.QueryString["BetId"]);

                    bool IsTeamBet = Request.QueryString["Type"] == null ? true : false;


                    if (Session["UserId"] != null)
                    {
                        if (!IsAgreed((int)Session["UserId"], betId, IsTeamBet))
                        {
                            btnAgreeWithBet.Enabled = false;
                            btnAgreeWithBet.Attributes.CssStyle.Add("opacity", ".5");
                            btnAgreeWithBet.ToolTip = "Bet Is Already Agreed With";
                        }
                    }
                    else
                    {
                        btnAcceptToBet.Enabled = false;
                        btnAcceptToBet.Attributes.CssStyle.Add("opacity", ".5");
                        btnAcceptToBet.ToolTip = "Must Be Logged In";

                        btnCopyBetModal.Enabled = false;
                        btnCopyBetModal.Attributes.CssStyle.Add("opacity", ".5");
                        btnCopyBetModal.ToolTip = "Must Be Logged In";

                        btnAgreeWithBet.Enabled = false;
                        btnAgreeWithBet.Attributes.CssStyle.Add("opacity", ".5");
                        btnAgreeWithBet.ToolTip = "Must Be Logged In";

                        btnSendBetEmail.Enabled = false;
                        btnSendBetEmail.Attributes.CssStyle.Add("opacity", ".5");
                        btnSendBetEmail.ToolTip = "Must Be Logged In";
                    }

                    if (!UsersBets.IsBetOpen(betId, IsTeamBet))
                    {
                        lblBetStatus.Text      = "Bet Is Closed";
                        btnAcceptToBet.Enabled = false;
                        btnAcceptToBet.Attributes.CssStyle.Add("opacity", ".5");
                    }


                    if (Session["UserId"] != null)
                    {
                        string BaseUrl = Request.RawUrl;
                        int    BetId   = int.Parse(Request.QueryString["BetId"]);

                        UserTracking.MemberTracking m = new UserTracking.MemberTracking();
                        m.InsertPageView((int)Session["UserId"], BaseUrl, BetId, IsTeamBet);
                    }

                    UserTracking Tracking = new UserTracking();

                    lblPageViews.Text = "# of Page Views: " + Tracking.PageViews(this.Page.Request.RawUrl).ToString();



                    if (Request.QueryString["Type"] == null)
                    {
                        GetTeamBet(betId);



                        SqlContextDataContext context = new SqlContextDataContext();

                        IEnumerable <tblTeamBet> TeamBets = from t in context.tblTeamBets
                                                            where t.pkBetId == betId
                                                            select t;

                        foreach (var TeamBet in TeamBets)
                        {
                            if (HttpContext.Current.Request.Cookies["TeamBets"] == null)
                            {
                                HttpCookie cook = new HttpCookie("TeamBets");
                                cook.Expires = DateTime.Now.AddDays(30);
                                NameValueCollection coll = new NameValueCollection();
                                coll.Set("Team", TeamBet.strTeam);
                                cook.Values.Add(coll);
                                HttpContext.Current.Response.SetCookie(cook);
                            }
                            else
                            {
                                HttpCookie cookie = HttpContext.Current.Request.Cookies["TeamBets"];

                                NameValueCollection nvc = cookie.Values;
                                nvc.Add("Team", TeamBet.strTeam);

                                foreach (string value in nvc.GetValues("Team"))
                                {
                                    // Label1.Text += value;
                                }

                                cookie.Values.Add(nvc);
                                HttpContext.Current.Response.SetCookie(cookie);
                            }
                        }
                    }
                    else
                    {
                        GetPlayerBet(betId);
                    }
                }
            }

            if (Request.QueryString["BulletinId"] != null)
            {
                GetReplyData();
                GetModal("modalReply");
            }

            if (Request.QueryString["BetId"] != null)
            {
                int BetId = Convert.ToInt32(Request.QueryString["BetId"]);

                bool IsTeamBet = Request.QueryString["Type"] == null ? true : false;


                litBulletinBoard.Text = GetBulletinBoard(BetId, IsTeamBet).ToString();

                if (ViewState["BulletinWasPosted"] != null)
                {
                    pnlBulletinPosted.Visible      = false;
                    ViewState["BulletinWasPosted"] = null;
                }
                else if (ViewState["MustBeLoggedIn"] != null)
                {
                    pnlBulletinPosted.Visible   = false;
                    ViewState["MustBeLoggedIn"] = null;
                }
            }
        }