Example #1
0
        //查看结果
        private void button5_Click(object sender, EventArgs e)
        {
            Form5 child = new Form5();

            child.ShowDialog();

            MySqliteLuckedPerson.WriteLuckedToSQL();
        }
Example #2
0
        private void SaveLuckPerson()
        {
            List <String> luck  = new List <String>();
            String        level = label2.Text;
            String        goods = label3.Text;

            String id         = label7.Text;
            String department = label8.Text;
            String name       = label9.Text;

            luck.Add(level);
            luck.Add(goods);
            luck.Add("已抽取");
            luck.Add(id);
            luck.Add(department);
            luck.Add(name);

            LuckedPerson.Add(luck);
            MySqliteLuckedPerson.WriteLuckedToSQL();
        }
Example #3
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();
        }