Beispiel #1
0
        private void btnAdd_Click(object sender, System.EventArgs e)
        {
            Team   team    = new Team();
            bool   sqlFlag = true;
            string sql     = "";

            foreach (DataGridItem dgi in this.dgMemberList.Items)
            {
                CheckBox cb = (CheckBox)(dgi.Cells[0].Controls[1]);
                if (cb.Checked == true)
                {
                    int    i  = dgi.ItemIndex;
                    string id = dgMemberList.DataKeys[i].ToString();
                    if (sqlFlag)
                    {
                        sql    += "" + id;
                        sqlFlag = false;
                    }
                    else
                    {
                        sql += " ,";
                        sql += id;
                    }
                }
            }
            //选择为空
            if (sql == String.Empty)
            {
                Response.Write("<script language=javascript>alert('请选择人员!');window.location='MemberListView.aspx?TeamID=" + ClassID + "';</script>");
            }
            else
            {
                if (team.AddMemberToTeam(sql, Int32.Parse(ClassID)))
                {
                    if (this.cbRemind.Checked == true)
                    {
                        sms_all(1);
                    }
                    Response.Write("<script language=javascript>alert('加入成员至组成功!');window.location='MemberListView.aspx?TeamID=" + ClassID + "';</script>");
                }
                else
                {
                    Server.Transfer("../Error.aspx");
                }
            }
            team = null;
        }