Ejemplo n.º 1
0
        private void button3_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("所有中奖人员和奖项都将重置\n确认清除吗", "清除奖项", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);

            //取消清除
            if (result == DialogResult.Cancel)
            {
                return;
            }

            //所有奖项重置为未抽取状态
            for (int i = 0; i < Form1.LuckCatagroyList.Count; i++)
            {
                List <String> catagroy = Form1.LuckCatagroyList[i];
                catagroy[2] = "未抽取";     //奖项状态
            }


            //已中奖人员名单添加到抽奖人员数据库
            for (int i = 0; i < Form1.LuckedPerson.Count; i++)
            {
                List <String> person = Form1.LuckedPerson[i];
                MySqlitePersons.AddOnePersonFormTable(person[3], person[4], person[5]);
                MySqlitePersons.ReadPersonsFormSQL();
            }

            //清除所有中奖人员名单,清空人员数据
            listView1.Items.Clear();
            Form1.LuckedPerson = new List <List <String> >();

            //删除数据库表
            MySqliteLuckedPerson.DeleteLuckedTable();
        }
Ejemplo n.º 2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            panel3.Visible = false;
            panel4.Visible = false;

            MySqlitePersons.ReadPersonsFormSQL();
            MySqliteConfig.ReadConfigsFormSQL();
            MySqliteCategory.ReadCategoryFormSQL();
            MySqliteLuckedPerson.ReadLuckedFormSQL();

            SetCompanyNameAndLogo();

            ShowNextLuck(GetNextLuckIndex());
        }
Ejemplo n.º 3
0
        private void RemoveLuckPerson()
        {
            //允许多次抽奖
            if (MultipleLuck)
            {
                return;
            }

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

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

            //从数据库重新获取人员名单
            MySqlitePersons.ReadPersonsFormSQL();
        }
Ejemplo n.º 4
0
        //放弃奖励,人员退回抽奖列表,奖项设为未抽取
        private void button2_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("放弃奖项", "确认放弃吗", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);

            //取消弃奖
            if (result == DialogResult.Cancel)
            {
                return;
            }

            int index = GetFocusedItemIndex();

            if (index == -1)
            {
                //没有选中任何项
                return;
            }

            List <String> luck = new List <String>();

            String state = listView1.FocusedItem.SubItems[3].Text;  //奖项状态

            if (state == "已弃奖")
            {
                MessageBox.Show("懒得理你");
                return;
            }
            String level = listView1.FocusedItem.SubItems[1].Text;      //奖项名
            String goods = listView1.FocusedItem.SubItems[2].Text;      //奖品名称

            String id         = listView1.FocusedItem.SubItems[4].Text; //中奖人工号
            String department = listView1.FocusedItem.SubItems[5].Text; //中奖人部门
            String name       = listView1.FocusedItem.SubItems[6].Text; //中奖人名字

            //添加到抽奖人员数据库
            MySqlitePersons.AddOnePersonFormTable(id, department, name);
            MySqlitePersons.ReadPersonsFormSQL();


            //已弃奖的奖项重置为未抽取状态
            for (int i = 0; i < Form1.LuckCatagroyList.Count; i++)
            {
                List <String> catagroy    = Form1.LuckCatagroyList[i];
                String        luckedLevel = catagroy[0]; //奖项名
                String        luckedGoods = catagroy[1]; //奖品名称
                String        luckedState = catagroy[2]; //奖项状态

                if (luckedState != "已抽取")
                {
                    continue;
                }
                if (level == luckedLevel && goods == luckedGoods)
                {
                    catagroy[2] = "未抽取";
                    break;
                }
            }
            //保存新的奖项列表
            MySqliteCategory.WriteCategoryToSQL();



            //已弃奖的中奖结果重置为已弃奖状态
            for (int i = 0; i < Form1.LuckedPerson.Count; i++)
            {
                List <String> lucked           = Form1.LuckedPerson[i];
                String        luckedLevel      = lucked[0];
                String        luckedGoods      = lucked[1];
                String        luckedState      = lucked[2];
                String        luckedId         = lucked[3];
                String        luckedDepartment = lucked[4];
                String        luckedName       = lucked[5];

                if (luckedState != "已抽取") //|| luckedState != "已弃奖")
                {
                    continue;
                }

                if (level == luckedLevel && goods == luckedGoods && id == luckedId && department == luckedDepartment && name == luckedName)
                {
                    lucked[2] = "已弃奖";
                    break;
                }
            }
            MySqliteLuckedPerson.WriteLuckedToSQL();

            //刷新列表,不然出BUG
            AddDataToListView();
        }