コード例 #1
0
        void databind()
        {
            DataBaseAccess db = new DataBaseAccess();
            DataTable      da = db.read("select * from TeamSum", CommandType.Text).Tables[0];
            DataView       dv = da.DefaultView;

            GridView1.DataKeyNames = new string[] { "teamname" };
            if (Session["sort"] != null)
            {
                dv.Sort = Session["sort"].ToString();
            }
            GridView1.DataSource = dv;
            GridView1.DataBind();
        }
コード例 #2
0
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            DataBaseAccess db          = new DataBaseAccess();
            string         playername  = GridView1.DataKeys[e.RowIndex]["playername"].ToString();
            string         turn        = GridView1.DataKeys[e.RowIndex]["turn"].ToString();
            DataTable      dt          = db.read("select playerorder from TeamPlayer where playername='" + playername + "'", CommandType.Text).Tables[0];
            string         playerorder = dt.Rows[0]["playerorder"].ToString();
            string         playergoals = ((TextBox)GridView1.Rows[e.RowIndex].Cells[3].Controls[0]).Text;

            db.command("update topscorer set playergoals='" + playergoals + "' where turn=" + turn + " and playerorder='" + playerorder + "'", CommandType.Text);
            GridView1.EditIndex = -1;
            BindGrid();
            Response.Write("<script>alert('更新成功!');</script>");
        }
コード例 #3
0
        protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e)
        {
            DropDownList1.Items.Clear();
            string turn = DropDownList3.SelectedValue;

            DropDownList1.Items.Add("--->选择球队<---".ToString());
            DataBaseAccess db = new DataBaseAccess();
            DataTable      da = db.read("select distinct teamname from LeagueStanding where turn='" + turn + "'", CommandType.Text).Tables[0];

            foreach (DataRow dr in da.Rows)
            {
                DropDownList1.Items.Add(new ListItem(dr["teamname"].ToString(), dr["teamname"].ToString()));
            }
        }
コード例 #4
0
 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Delete")
     {
         DataBaseAccess db  = new DataBaseAccess();
         GridViewRow    drv = ((GridViewRow)(((ImageButton)(e.CommandSource)).Parent.Parent)); //此得出的值是表示那行被选中的索引值
         //int number = Convert.ToInt32(GridView1.DataKeys[drv.RowIndex].Value); //此获取的值为GridView中绑定数据库中的主键值
         ////int number =(int.Parse)(e.CommandArgument.ToString());
         int turn       = Int32.Parse(GridView1.DataKeys[drv.RowIndex]["turn"].ToString());
         int FieldOrder = Int32.Parse(GridView1.DataKeys[drv.RowIndex]["FieldOrder"].ToString());
         db.command("delete from ScheduleArrange where turn=" + turn + " and FieldOrder=" + FieldOrder + "", CommandType.Text);
         BindGrid();
         Response.Write("<script>alert('删除成功!');</script>");
     }
 }
コード例 #5
0
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            string       Courtnam   = GridView1.DataKeys[e.RowIndex].Value.ToString();
            string       Courtplac  = ((TextBox)GridView1.Rows[e.RowIndex].Cells[1].Controls[0]).Text;
            SqlParameter Courtplace = new SqlParameter("@Courtplace", Courtplac);
            SqlParameter Courtname  = new SqlParameter("@Courtname", Courtnam);
            SqlParameter tablename  = new SqlParameter("@tablename", "JudgeInformation");
            // @result
            DataBaseAccess db = new DataBaseAccess();

            db.command("updatecourt", CommandType.StoredProcedure, Courtplace, Courtname);
            GridView1.EditIndex = -1;
            BindGrid();
            Response.Write("<script>alert('更新成功!');</script>");
        }
コード例 #6
0
 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Delete")
     {
         DataBaseAccess db          = new DataBaseAccess();
         GridViewRow    drv         = ((GridViewRow)(((ImageButton)(e.CommandSource)).Parent.Parent)); //此得出的值是表示那行被选中的索引值
         int            turn        = Int32.Parse(GridView1.DataKeys[drv.RowIndex]["turn"].ToString());
         string         playername  = (GridView1.DataKeys[drv.RowIndex]["playername"].ToString());
         DataTable      dt          = db.read("select playerorder from TeamPlayer where playername='" + playername + "'", CommandType.Text).Tables[0];
         string         playerorder = dt.Rows[0]["playerorder"].ToString();
         db.command("delete from RedYellowCards where playerorder='" + playerorder + "' and turn='" + turn + "'", CommandType.Text);
         BindGrid();
         Response.Write("<script>alert('删除成功!');</script>");
     }
 }
コード例 #7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         PlayerBind();
         TeamBind();
         DataBaseAccess da = new DataBaseAccess();
         DataTable      dt = da.read("select distinct turn from RedYellowCards", CommandType.Text).Tables[0];
         DropDownList1.Items.Add("--->轮次<---".ToString());
         foreach (DataRow dr in dt.Rows)
         {
             DropDownList1.Items.Add(new ListItem(dr["turn"].ToString(), dr["turn"].ToString()));
         }
     }
 }
コード例 #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         DataBaseAccess db = new DataBaseAccess();
         dt = db.read("findmatchnode", CommandType.StoredProcedure).Tables[0];
         DataRow[] rows = dt.Select("topid='0'");
         for (int i = 0; i < rows.Length; i++)
         {
             TreeNode node = new TreeNode(rows[i]["permissionname"].ToString(), rows[i]["permissionid"].ToString(), "", rows[i]["url"].ToString(), "MainFrame");
             TreeView1.Nodes.Add(node);
             AddChildNode(node, dt.Select("topid='" + rows[i]["permissionid"].ToString() + "'"));
         }
     }
 }
コード例 #9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         DataBaseAccess db = new DataBaseAccess();
         DataTable      da = db.read("select distinct turn from ScheduleArrange", CommandType.Text).Tables[0];
         DropDownList1.Items.Add("--->轮次<----".ToString());
         foreach (DataRow dr in da.Rows)
         {
             DropDownList1.Items.Add(new ListItem(dr["turn"].ToString()));
         }
         PlayerBind();
         TeamBind();
     }
 }
コード例 #10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         DataBaseAccess db = new DataBaseAccess();
         dt = db.read("select * from teamnode where username='******'", CommandType.Text).Tables[0];
         DataRow[] rows = dt.Select("topid='0'");
         for (int i = 0; i < rows.Length; i++)
         {
             TreeNode node = new TreeNode(rows[i]["permissionname"].ToString(), rows[i]["permissionid"].ToString(), "", rows[i]["url"].ToString(), "MainFrame");
             TreeView1.Nodes.Add(node);
             AddChildNode(node, dt.Select("topid='" + rows[i]["permissionid"].ToString() + "'"));
         }
         BindGrid();
     }
 }
コード例 #11
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            DataBaseAccess db = new DataBaseAccess();

            try
            {
                DataTable dt = db.read("select Username from userinformation where Username='******'", CommandType.Text).Tables[0];
                int       i  = dt.Rows.Count;
                if (i.ToString() == "0")
                {
                    if (TextBox2.Text == TextBox3.Text)
                    {
                        SqlParameter sname   = new SqlParameter("@Username", TextBox1.Text);
                        SqlParameter spwd    = new SqlParameter("@UserPassword", TextBox2.Text);
                        SqlParameter stype   = new SqlParameter("@userType", DropDownList1.SelectedValue.ToString());
                        SqlParameter semail  = new SqlParameter("@UserEmail", TextBox4.Text);
                        SqlParameter stel    = new SqlParameter("@Usertelephone", TextBox5.Text);
                        SqlParameter sresult = new SqlParameter("@result", SqlDbType.Int);
                        sresult.Direction = ParameterDirection.Output;
                        db.command("insertuser", CommandType.StoredProcedure, sname, spwd, stype, semail, stel, sresult);
                        if (sresult.Value.ToString() == "1")
                        {
                            Response.Redirect("Login.aspx");
                            //Response.Write("<script>alert('继续');</script>");
                        }
                        else
                        {
                            Response.Write("<script>alert('注册失败,请重新注册');</script>");
                        }
                    }
                    else
                    {
                        TextBox2.Text = "";
                        TextBox3.Text = "";
                        Response.Write("<script>alert('两次密码不一致!');</script>");
                    }
                }
                else
                {
                    TextBox2.Text = "";
                    TextBox3.Text = "";
                    Response.Write("<script>alert('该用户已存在!');</script>");
                }
            }
            catch (Exception ex)
            { throw ex; }
        }
コード例 #12
0
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            DataBaseAccess db        = new DataBaseAccess();
            string         teamname  = GridView1.DataKeys[e.RowIndex]["teamname"].ToString();
            string         turn      = GridView1.DataKeys[e.RowIndex]["turn"].ToString();
            string         teamscore = ((TextBox)GridView1.Rows[e.RowIndex].Cells[2].Controls[0]).Text;
            string         teamlose  = ((TextBox)GridView1.Rows[e.RowIndex].Cells[3].Controls[0]).Text;
            //string score = ((DropDownList)GridView1.Rows[e.RowIndex].Cells[4].Controls[0]).Text;
            string    score = ((DropDownList)GridView1.Rows[e.RowIndex].FindControl("dropdownlist1")).SelectedValue.ToString();
            DataTable dt    = db.read("select score from LeagueStanding where teamname='" + teamname + "' and turn=" + turn + "-1", CommandType.Text).Tables[0];
            string    scor  = dt.Rows[0]["score"].ToString();

            db.command("update LeagueStanding set teamscore='" + teamscore + "',teamlose='" + teamlose + "',score=" + scor + "+" + score + " where turn=" + turn + " and teamname='" + teamname + "'", CommandType.Text);
            GridView1.EditIndex = -1;
            BindGrid();
            Response.Write("<script>alert('更新成功!');</script>");
        }
コード例 #13
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            DataBaseAccess db = new DataBaseAccess();

            try
            {
                SqlParameter turn           = new SqlParameter("@turn", TextBox1.Text);
                SqlParameter FieldOrder     = new SqlParameter("@FieldOrder", TextBox2.Text);
                SqlParameter fixture        = new SqlParameter("@fixture", TextBox3.Text);
                SqlParameter A              = new SqlParameter("@A", DropDownList1.SelectedValue.ToString());
                SqlParameter B              = new SqlParameter("@B", DropDownList2.SelectedValue.ToString());
                SqlParameter courtname      = new SqlParameter("@courtname", TextBox6.Text);
                SqlParameter Judgername     = new SqlParameter("@Judgername", DropDownList3.SelectedValue.ToString());
                SqlParameter Timekeepername = new SqlParameter("@Timekeepername", DropDownList4.SelectedValue.ToString());
                SqlParameter sprv           = new SqlParameter("@sprv", SqlDbType.Int);
                sprv.Direction = ParameterDirection.Output;
                db.command("insertmatch", CommandType.StoredProcedure, turn, FieldOrder, fixture, A, B, courtname, Judgername, Timekeepername, sprv);
                if (sprv.Value.ToString() == "0")
                {
                    //if (DropDownList1.SelectedValue.ToString() == "球队管理员")
                    //{
                    //    Response.Redirect("teammanage.aspx");
                    //}
                    //else
                    //{
                    //    if (DropDownList1.SelectedValue.ToString() == "赛事管理员")
                    //    {
                    //        Response.Redirect("matchmanage.aspx");
                    //    }
                    //    else
                    //    {
                    //        Response.Write("<script>alert('登录成功!');</script>");
                    //    }
                    //}
                    Response.Write("<script>alert('添加成功!');</script>");
                }
                else
                {
                    TextBox2.Text = "";
                    Response.Write("<script>alert('插入失败!');</script>");
                }
            }
            catch (Exception ex)
            { throw ex; }
        }
コード例 #14
0
        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            DropDownList2.Items.Clear();
            DataBaseAccess db     = new DataBaseAccess();
            string         turn   = DropDownList1.SelectedValue;
            DataTable      dateam = db.read("select teama from ScheduleArrange where turn='" + turn + "'", CommandType.Text).Tables[0];

            DropDownList2.Items.Add("--->请选择球队<---".ToString());
            foreach (DataRow dr in dateam.Rows)
            {
                DropDownList2.Items.Add(new ListItem(dr["teama"].ToString()));
            }
            DataTable dateamb = db.read("select teamb from ScheduleArrange where turn='" + turn + "'", CommandType.Text).Tables[0];

            foreach (DataRow dr in dateamb.Rows)
            {
                DropDownList2.Items.Add(new ListItem(dr["teamb"].ToString()));
            }
        }
コード例 #15
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         DataBaseAccess db = new DataBaseAccess();
         dt = db.read("findnode", CommandType.StoredProcedure).Tables[0];
         DataRow[] rows = dt.Select("topid='0'");
         for (int i = 0; i < rows.Length; i++)
         {
             TreeNode node = new TreeNode(rows[i]["permissionname"].ToString(), rows[i]["permissionid"].ToString(), "", rows[i]["url"].ToString(), "MainFrame");
             TreeView1.Nodes.Add(node);
             AddChildNode(node, dt.Select("topid='" + rows[i]["permissionid"].ToString() + "'"));
         }
         DataTable da = db.read("select distinct teamname from teamsum", CommandType.Text).Tables[0];
         DropDownList1.Items.Add("--->请选择球队名称<---".ToString());
         foreach (DataRow dr in da.Rows)
         {
             DropDownList1.Items.Add(new ListItem(dr["teamname"].ToString()));
         }
     }
 }
コード例 #16
0
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            string playerorder  = GridView1.DataKeys[e.RowIndex].Value.ToString();
            string playername   = ((TextBox)GridView1.Rows[e.RowIndex].Cells[1].Controls[0]).Text;
            string playernumber = ((TextBox)GridView1.Rows[e.RowIndex].Cells[2].Controls[0]).Text;
            string datebirth    = ((TextBox)GridView1.Rows[e.RowIndex].Cells[3].Controls[0]).Text;
            string IDnumber     = ((TextBox)GridView1.Rows[e.RowIndex].Cells[4].Controls[0]).Text;
            string gender       = ((DropDownList)GridView1.Rows[e.RowIndex].FindControl("DropAttri")).SelectedValue.ToString();
            string teamname     = DropDownList1.SelectedValue;

            SqlParameter[] sp =
            {
                new SqlParameter("@playerorder",  playerorder),
                new SqlParameter("@playername",   playername),
                new SqlParameter("@playernumber", playernumber),
                new SqlParameter("@gender",       gender),
                new SqlParameter("@datebirth",    datebirth),
                new SqlParameter("@IDnumber",     IDnumber),
                new SqlParameter("@teamname",     teamname),
                new SqlParameter("@updateresult", SqlDbType.Int)
            };
            sp[7].Direction = ParameterDirection.Output;
            DataBaseAccess db = new DataBaseAccess();

            if (gender.ToString() != null)
            {
                db.command("updateplayer", CommandType.StoredProcedure, sp);
            }
            GridView1.EditIndex = -1;
            databind();
            if (sp[7].Value.ToString() == "0")
            {
                Response.Write("<script>alert('更新成功!');</script>");
            }
            else
            {
                Response.Write("<script>alert('更新失败!');</script>");
            }
        }
コード例 #17
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            DataBaseAccess db = new DataBaseAccess();

            try
            {
                SqlParameter sname = new SqlParameter("@Username", TextBox1.Text);
                SqlParameter spwd  = new SqlParameter("@UserPassword", TextBox2.Text);
                SqlParameter stype = new SqlParameter("@userType", DropDownList1.SelectedValue.ToString());
                SqlParameter sprv  = new SqlParameter("@checkresult", SqlDbType.Int);
                sprv.Direction = ParameterDirection.Output;
                db.command("checkuser", CommandType.StoredProcedure, sname, spwd, stype, sprv);
                if (sprv.Value.ToString() == "1")
                {
                    if (DropDownList1.SelectedValue.ToString() == "球队管理员")
                    {
                        Response.Redirect("teammanage.aspx");
                    }
                    else
                    {
                        if (DropDownList1.SelectedValue.ToString() == "赛事管理员")
                        {
                            Response.Redirect("matchmanage.aspx");
                        }
                        else
                        {
                            Response.Redirect("scoremanage.aspx");
                        }
                    }
                }
                else
                {
                    TextBox2.Text = "";
                    Response.Write("<script>alert('用户名或密码错误!');</script>");
                }
            }
            catch (Exception ex)
            { throw ex; }
        }
コード例 #18
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         DataBaseAccess db = new DataBaseAccess();
         dt = db.read("select * from teamnode where username='******'", CommandType.Text).Tables[0];
         DataRow[] rows = dt.Select("topid='0'");
         for (int i = 0; i < rows.Length; i++)
         {
             TreeNode node = new TreeNode(rows[i]["permissionname"].ToString(), rows[i]["permissionid"].ToString(), "", rows[i]["url"].ToString(), "MainFrame");
             TreeView1.Nodes.Add(node);
             AddChildNode(node, dt.Select("topid='" + rows[i]["permissionid"].ToString() + "'"));
         }
         DataTable da = db.read("select distinct turn from LeagueStanding", CommandType.Text).Tables[0];
         DropDownList3.Items.Add("--->选择轮次<---".ToString());
         foreach (DataRow dr in da.Rows)
         {
             DropDownList3.Items.Add(new ListItem(dr["turn"].ToString(), dr["turn"].ToString()));
         }
         DataTable ds = db.read("select top 100 turn from LeagueStanding order by turn desc", CommandType.Text).Tables[0];
         tur = ds.Rows[0]["turn"].ToString();
     }
 }