Esempio n. 1
0
        private void editgroup_Load(object sender, EventArgs e)
        {
            //读取当前用户的姓名  学号 作为队长的信息
            SqlDataReader myname = SqlDbHelper.ExecuteReader(string.Format("select name,major,grade from stupasswordtable where account='{0}'", id));

            myname.Read();
            captainname.Text = myname[0].ToString();
            captainid.Text   = id;
            draw_controls();
            DataTable team = SqlDbHelper.ExecuteDataTable(string.Format("select * from team where captainid='{0}'", id));

            if (team.Rows.Count != 0)
            {
                topicname.Text      = team.Rows[0]["topicname"].ToString();
                topicintroduce.Text = team.Rows[0]["topicintroduce"].ToString();
                txts1[0].Text       = team.Rows[0]["memberonename"].ToString();
                txts[0].Text        = team.Rows[0]["memberoneid"].ToString();
                txts1[1].Text       = team.Rows[0]["membertwoname"].ToString();
                txts[1].Text        = team.Rows[0]["membertwoid"].ToString();
                txts1[2].Text       = team.Rows[0]["memberthreename"].ToString();
                txts[2].Text        = team.Rows[0]["memberthreeid"].ToString();
            }
            string a = myname[1].ToString();

            dt = SqlDbHelper.ExecuteDataTable(string.Format("select id,name from stupasswordtable where groupID='0' and major='{0}'", myname[1].ToString()));
            dataGridView1.DataSource = dt;
        }
Esempio n. 2
0
        public editgroup(string getid)
        {
            InitializeComponent();
            id          = getid;
            teamid.Text = id;
            //captainid.Text = id;
            SqlDataReader thisperson = SqlDbHelper.ExecuteReader(string.Format("select name,major,grade from stupasswordtable where account='{0}'", id));

            thisperson.Read();
            studentlist = new DataTable();
            studentlist = SqlDbHelper.ExecuteDataTable(string.Format("select id,name from stupasswordtable where groupID='0' and major='{0}'", thisperson[1].ToString()));
        }
Esempio n. 3
0
        public tea_issue()
        {
            InitializeComponent();
            readacademy = SqlDbHelper.ExecuteReader(string.Format("select academy from stupasswordtable where account='{0}'", id));
            readacademy.Read();

            tealist = SqlDbHelper.ExecuteDataTable(string.Format("select * from teapasswordtable where academy='{0}'", readacademy[0].ToString()));
            for (int i = 0; i < teashow.Length; i++)
            {
                teashow[i] = new tea_show(tealist.Rows[i]);
            }
        }
Esempio n. 4
0
        /**************************************************************************************************************************/
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void timer1_Tick(object sender, EventArgs e)
        {
            SqlDataReader myname = SqlDbHelper.ExecuteReader(string.Format("select name,major,grade from stupasswordtable where account='{0}'", id));

            myname.Read();
            DataTable dtt = new DataTable();

            dtt = SqlDbHelper.ExecuteDataTable(string.Format("select id,name from stupasswordtable where groupID='0' and major='{0}'", myname[1].ToString()));
            if (!CompareDataTable(studentlist, dtt))
            {
                this.dataGridView1.DataSource = null;
                this.dataGridView1.Rows.Clear();
                this.dataGridView1.DataSource = dtt;
                studentlist.Rows.Clear();
                studentlist = dtt;
            }
            //DataTable flash = new DataTable();
            //flash = SqlDbHelper.ExecuteDataTable(string.Format("select id,name from stupasswordtable where groupID='0' and major='{0}'", myname[1].ToString()));
            //DataTable  t=
            //dataGridView1.DataSource = dtt;
        }
Esempio n. 5
0
        public tea_issue(string getid)
        {
            InitializeComponent();
            id          = getid;
            readacademy = SqlDbHelper.ExecuteReader(string.Format("select academy from stupasswordtable where account='{0}'", id));
            //获取当前用户所在学院

            readacademy.Read();

            tealist = SqlDbHelper.ExecuteDataTable(string.Format("select * from teapasswordtable where academy='{0}'", readacademy[0].ToString()));
            //获取当前学院导师  形成列表
            for (int i = 0; i < tealist.Rows.Count; i++)
            {
                if (tealist.Rows.Count != 0)
                {
                    teashow[i] = new tea_show(tealist.Rows[i]);
                }
            }

            mywill = SqlDbHelper.ExecuteDataTable(string.Format("select * from will where stuid='{0}'", id));
            //读取当前用户的志愿信息
        }
Esempio n. 6
0
 private void thirdwill_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (thirdwill.Columns[e.ColumnIndex].Name == "退选")
     {
         SqlDataReader readcaptainid = SqlDbHelper.ExecuteReader(string.Format("select captainid from team where teamnumber=(select teamnumber from team where captainid='{0}' or memberoneid='{0}' or membertwoid='{0}' or memberthreeid='{0}')", id));
         if (readcaptainid.HasRows)
         {
             readcaptainid.Read();
             SqlDataReader readnumber = SqlDbHelper.ExecuteReader(string.Format("select mnumber from team where captainid='{0}'", readcaptainid[0].ToString()));
             readnumber.Read();
             if (id == readcaptainid[0].ToString())
             {
                 SqlDbHelper.ExecuteNonQuery(string.Format("update will set thirdwill = NULL,thirdwillname = NULL,isaccess3=NULL where stuid='{0}'", id));
                 label4.Text = "已成功退选第三志愿!";
                 thirdwill.Rows.Clear();
                 thirdwill.Columns.Remove("退选");
             }
             else
             {
                 MessageBox.Show("仅能由队长退选志愿");
             }
         }
     }
 }
Esempio n. 7
0
        private void summit_Click(object sender, EventArgs e)
        {
            SqlDataReader reader = SqlDbHelper.ExecuteReader(string.Format("select name from stupasswordtable where account='{0}'", id));

            reader.Read();

            int       count       = 0;
            string    willteaid   = null;
            string    willteaname = null;
            DataTable table       = SqlDbHelper.ExecuteDataTable(string.Format("select * from team where captainid='{0}' or memberoneid='{0}' or membertwoid='{0}' or memberthreeid='{0}'", id)); //获取团队信息  以表形式呈现
            DataTable a           = SqlDbHelper.ExecuteDataTable(string.Format("select * from will where stuid='{0}'", table.Rows[0]["teamnumber"].ToString()));                                  //获取当前团队的志愿表 有行则已经填报过

            string[] mywill = new string[3] {
                null, null, null
            };

            if (a.Rows.Count != 0)
            {
                mywill[0] = a.Rows[0]["firstwill"].ToString();
                mywill[1] = a.Rows[0]["secondwill"].ToString();
                mywill[2] = a.Rows[0]["thirdwill"].ToString();
            }


            foreach (tea_show b in teashow)
            {
                if (b != null)
                {
                    if (b.ischoose)
                    {
                        for (int i = 0; i < 3; i++)
                        {
                            if (b.teaid == mywill[i])
                            {
                                MessageBox.Show("已经选择过该导师啦");
                                return;
                            }
                        }
                        willteaid   = b.teaid;
                        willteaname = b.teaname;
                        count++;
                    }
                }
            }

            if (count == 0)
            {
                MessageBox.Show("还没有选择导师哟");
                return;
            }
            else if (count == 1)
            {
                try
                {
                    if (table.Rows.Count != 0)                           //当前有这个团队
                    {
                        if (id == table.Rows[0]["captainid"].ToString()) //判断当前角色是否是队长
                        {
                            if (a.Rows.Count != 0)                       //判断当前团队是否有填报过志愿
                            {
                                switch (whichwill.SelectedItem.ToString())
                                {
                                case "第一志愿":
                                    if (a.Rows[0].IsNull("firstwill"))
                                    {
                                        a.Rows[0]["firstwill"]     = willteaid;
                                        a.Rows[0]["firstwillname"] = willteaname;
                                        a.Rows[0]["isaccess1"]     = 0;
                                    }
                                    else
                                    {
                                        MessageBox.Show("已经填报第一志愿,如需修改请先退选");
                                        return;
                                    }
                                    break;

                                case "第二志愿":
                                    if (a.Rows[0].IsNull("secondwill"))
                                    {
                                        a.Rows[0]["secondwill"]     = willteaid;
                                        a.Rows[0]["secondwillname"] = willteaname;
                                        a.Rows[0]["isaccess2"]      = 0;
                                    }
                                    else
                                    {
                                        MessageBox.Show("已经填报第二志愿,如需修改请先退选");
                                        return;
                                    }
                                    break;

                                case "第三志愿":
                                    if (a.Rows[0].IsNull("thirdwill"))
                                    {
                                        a.Rows[0]["thirdwill"]     = willteaid;
                                        a.Rows[0]["thirdwillname"] = willteaname;
                                        a.Rows[0]["isaccess3"]     = 0;
                                    }
                                    else
                                    {
                                        MessageBox.Show("已经填报第三志愿,如需修改请先退选");
                                        return;
                                    }
                                    break;

                                default:
                                    break;
                                }
                            }
                            else
                            {
                                DataRow newteawill = a.NewRow();
                                newteawill["stuname"]     = table.Rows[0]["captainname"];
                                newteawill["stuid"]       = table.Rows[0]["teamnumber"];
                                newteawill["subjectname"] = table.Rows[0]["topicname"];
                                newteawill["isteam"]      = 1;

                                switch (whichwill.SelectedItem.ToString())
                                {
                                case "第一志愿":
                                    newteawill["firstwill"]     = willteaid;
                                    newteawill["firstwillname"] = willteaname;
                                    newteawill["isaccess1"]     = 0;
                                    break;

                                case "第二志愿":
                                    newteawill["secondwill"]     = willteaid;
                                    newteawill["secondwillname"] = willteaname;
                                    newteawill["isaccess2"]      = 0;
                                    break;

                                case "第三志愿":
                                    newteawill["thirdwill"]     = willteaid;
                                    newteawill["thirdwillname"] = willteaname;
                                    newteawill["isaccess3"]     = 0;
                                    break;

                                default:
                                    break;
                                }
                                a.Rows.Add(newteawill);
                            }

                            try
                            {
                                SqlDbHelper.updatedatatable(a, "will");

                                label2.Text = whichwill.Text + "已选择" + willteaname;
                            }
                            catch (System.Data.SqlClient.SqlException)
                            {
                                MessageBox.Show("请完善课题信息或先填报其他志愿");
                            }
                        }
                        else
                        {
                            MessageBox.Show("请由队长来填报志愿");
                        }
                    }
                    else
                    {
                        MessageBox.Show("暂无团队信息");
                    }
                }
                catch (System.NullReferenceException)
                {
                    MessageBox.Show("未选中志愿");
                }
            }

            else if (count > 1)
            {
                MessageBox.Show("一次志愿只能填一位导师哟");
                return;
            }
        }