コード例 #1
0
        protected void AddBtn_Click(object sender, EventArgs e)
        {
            //int batteamid, int bowlteamid, int strikerid, int nonstriker, int bowlerid, int runonball, int balltype, int wickettype)
            int        batteamid    = (int)Session["batteamid"];
            int        bowlteamid   = (int)Session["bowlteamid"];
            int        strikerid    = (int)Session["striker"];
            int        nonstrikerid = (int)Session["nonstriker"];
            int        bowlerid     = (int)Session["bowler"];
            int        runonball    = Int32.Parse(ddlrun.SelectedValue);
            int        balltype     = Int32.Parse(ddlballtype.SelectedValue);
            int        wickettype   = Int32.Parse(ddlwicket.SelectedValue);
            double     overs        = client.updateBall(batteamid, bowlteamid, strikerid, nonstrikerid, bowlerid, runonball, balltype, wickettype);
            int        matchid      = (int)Session["matchid"];
            Commentary c            = new Commentary
            {
                Match_ID = matchid,
                Over     = overs,
                Comment  = tbcomment.Text,
            };

            //Adding Commentary
            client.insertCommentary(c);

            Session["overs"] = overs;

            //For wicket, redirect to other page
            if (wickettype != 0)
            {
                Response.Redirect("wicket.aspx");
            }

            //Change strike in odd runs
            if (runonball == 1 || runonball == 3)
            {
                int temp1 = (int)Session["striker"];
                Session["striker"]    = (int)Session["nonstriker"];
                Session["nonstriker"] = temp1;
            }

            double temp = overs - (int)Math.Floor(overs);

            temp = Math.Round((Double)temp, 1);
            if (temp == 0.6)
            {
                Response.Redirect("over.aspx");
            }

            Response.Redirect("scoreboard.aspx");
        }