/// <summary>
        /// 将指定人员的数据从数据库读取并显示,方便编辑人员信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void 编辑ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SchoolInfoInit();
            PersonnelManagement personnelManagement = new PersonnelManagement();
            int rowIndex = dgvPerson.CurrentRow.Index;     //获取选择行号

            tbUID.Text = dgvPerson.Rows[rowIndex].Cells[0].Value.ToString();
            uint uID   = (UInt32)Convert.ToInt32(tbUID.Text);
            int  index = personnelManagement.uIDtoIndex(uID);

            if (index < 0)
            {
                output("数据库中没有指定ID用户");
                return;
            }
            tbName.Text      = personnelManagement.PersonList[index].name;
            cbSex.Text       = personnelManagement.PersonList[index].sex;
            tbStudentID.Text = personnelManagement.PersonList[index].studentID;

            string domitory = personnelManagement.PersonList[index].dormitory;
            byte   one      = (byte)domitory.LastIndexOf(")");
            string Building = domitory.Substring(0, one + 1);
            string Floor    = domitory.Substring(one + 1, 1);

            tbDomitory.Text = domitory.Substring(one + 2, 3);

            if (cbBuilding.Items.Contains(Building))
            {
                cbBuilding.DropDownStyle = ComboBoxStyle.DropDownList;
                cbBuilding.Text          = Building;
            }
            else
            {
                cbBuilding.DropDownStyle = ComboBoxStyle.Simple;
                cbBuilding.Text          = Building;
            }

            if (cbFloor.Items.Contains(Floor))
            {
                cbFloor.DropDownStyle = ComboBoxStyle.DropDownList;
                cbFloor.Text          = Floor;
            }
            else
            {
                cbFloor.DropDownStyle = ComboBoxStyle.Simple;
                cbFloor.Text          = Floor;
            }

            cbActiveState.Checked = personnelManagement.PersonList[index].activeState == 0 ? false : true;

            string authority = personnelManagement.PersonList[index].authority;

            cbAuthority = CheckBoxComboBoxOP.checkItem(cbAuthority, authority);

            string major = personnelManagement.PersonList[index].major;

            one = (byte)major.LastIndexOf(" ");
            string Institute = major.Substring(0, one);
            string Major     = major.Substring(one + 1, major.Length - one - 1);

            if (cbInstitute.Items.Contains(Institute))
            {
                cbInstitute.DropDownStyle = ComboBoxStyle.DropDownList;
                cbInstitute.Text          = Institute;
            }
            else
            {
                cbInstitute.DropDownStyle = ComboBoxStyle.Simple;
                cbInstitute.Text          = Institute;
            }

            if (cbMajor.Items.Contains(Major))
            {
                cbMajor.DropDownStyle = ComboBoxStyle.DropDownList;
                cbMajor.Text          = Major;
            }
            else
            {
                cbMajor.DropDownStyle = ComboBoxStyle.Simple;
                cbMajor.Text          = Major;
            }

            //cbInstitute.Text = major.Substring(0, one);
            //cbMajor.Text = major.Substring(one + 1, major.Length - one - 1);

            tbQQ.Text             = personnelManagement.PersonList[index].QQ;
            tbWeiXin.Text         = personnelManagement.PersonList[index].weiXin;
            tbTel.Text            = personnelManagement.PersonList[index].tel;
            dtpBirthday.Value     = DateTime.Parse(personnelManagement.PersonList[index].birthday);
            cbIsLimitTime.Checked = personnelManagement.PersonList[index].isLimitTime == 0 ? false : true;
            dtpLimitTime.Value    = DateTime.Parse(personnelManagement.PersonList[index].limitTime);

            tbRFID.Text   = personnelManagement.PersonList[index].cardID.ToString("X8");;
            tbEigen1.Text = personnelManagement.PersonList[index].eigen[0];
            tbEigen2.Text = personnelManagement.PersonList[index].eigen[1];
            tbEigen3.Text = personnelManagement.PersonList[index].eigen[2];
            tbEigen4.Text = personnelManagement.PersonList[index].eigen[3];
            tbEigen5.Text = personnelManagement.PersonList[index].eigen[4];
            fPath         = Environment.CurrentDirectory + @"\picture\" + tbUID.Text.PadLeft(4, '0') + "_" + tbName.Text + ".jpg";
            try
            {
                if (File.Exists(fPath) != true)
                {
                    output("头像不存在!"); pbPortrait.Image = null; return;
                }
                pbPortrait.Image = Image.FromFile(Environment.CurrentDirectory + @"\picture\" + tbUID.Text.PadLeft(4, '0') + "_" + tbName.Text + ".jpg");
                output("读取信息成功!");
            }
            catch (Exception ex)
            {
                output(ex.Message);
            }
        }
        /// <summary>
        /// 清空所有文本框的数据,方便下次添加人员
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void 新增toolStripMenuItem1_Click(object sender, EventArgs e)
        {
            SchoolInfoInit();
            string cellString = "";
            int    rowsCount  = dgvPerson.Rows.Count;//获取总人数

            if (rowsCount == 0)
            {
                tbUID.Text = 1.ToString();
            }
            else
            {
                cellString = dgvPerson.Rows[rowsCount - 1].Cells[0].Value.ToString().Trim();//初始化为最后一行的用户号
            }
            tbUID.Text        = (rowsCount + 1).ToString();
            tbName.Text       = null;
            cbSex.Text        = null;
            tbStudentID.Text  = null;
            tbQQ.Text         = null;
            tbTel.Text        = null;
            cbBuilding.Text   = null; cbFloor.Text = null; tbDomitory.Text = null;
            cbAuthority       = CheckBoxComboBoxOP.checkItem(cbAuthority, "");
            cbInstitute.Text  = null;
            cbMajor.Text      = null;
            tbWeiXin.Text     = null;
            tbRFID.Text       = null;
            tbEigen1.Text     = null;
            tbEigen2.Text     = null;
            tbEigen3.Text     = null;
            tbEigen4.Text     = null;
            tbEigen5.Text     = null;
            dtpBirthday.Value = DateTime.Now;
            pbPortrait.Image  = null;
            fPath             = Environment.CurrentDirectory + @"\picture\defaultAvatar.jpg";
            Image pic = Image.FromFile(fPath);

            pbPortrait.Image = pic;

            if (cellString != "")
            {
                if (rowsCount != int.Parse(cellString))//如果最后一行用户号不等于用户数,则有空缺的用户号
                {
                    bool isSearch = false;
                    for (int i = 1; i < rowsCount; i++)//从1号一直搜索到rowsCount - 1号用户
                    {
                        isSearch = false;
                        for (int j = 0; j < rowsCount; j++)                                  //搜索有无第i号用户
                        {
                            cellString = dgvPerson.Rows[j].Cells[0].Value.ToString().Trim(); //得到用户号
                            if (i == int.Parse(cellString))
                            {
                                isSearch = true;//如果搜索到有第i号用户,跳出循环,搜索下一用户
                                break;
                            }
                        }
                        if (isSearch == false)//如果没有搜索到i号用户,证明第i号用户空缺
                        {
                            tbUID.Text = i.ToString();
                            break;
                        }
                    }
                }
            }
        }