Ejemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            //清除选中功能

            foreach (ListViewItem item in listView1.SelectedItems)  //选中项遍历
            {
                String indexString = item.Text.ToString();
                int    index       = Convert.ToInt32(indexString);
                Form1.PersonList.RemoveAt(index - 1);

                //获取工号
                String id = listView1.SelectedItems[0].SubItems[1].Text.ToString();
                //获取名字
                String name = listView1.SelectedItems[0].SubItems[3].Text.ToString();

                //从数据库表删除该id人员
                MySqlitePersons.DeleteOnePersonFormTable(id, name);


                listView1.Items.Remove(item);   //按项移除


                break;
            }


            //刷新列表,不然出BUG
            AddDataToListView();
        }
Ejemplo n.º 2
0
        private void RemoveLuckPerson()
        {
            //允许多次抽奖
            if (MultipleLuck)
            {
                return;
            }

            //获取中奖人工号和名字
            String id   = label7.Text;
            String name = label9.Text;

            //从数据库中删除
            MySqlitePersons.DeleteOnePersonFormTable(id, name);

            //从数据库重新获取人员名单
            MySqlitePersons.ReadPersonsFormSQL();
        }