private void button1_Click(object sender, EventArgs e)
        {
            //information complete check
            if (CplHelper.IsNull(txtIdcard.Text) || CplHelper.IsNull(txtAccount.Text) || CplHelper.IsNull(txtMemID.Text) ||
                CplHelper.IsNull(txtMemName.Text) || CplHelper.IsNull(txtTel.Text))
            {
                MessageBox.Show("信息录入不全!");
                return;
            }
            if (!CplHelper.IsEmail(txtTel.Text))
            {
                MessageBox.Show("邮箱格式错误!");
                return;
            }
            if (!CplHelper.IsDecimal(txtAccount.Text))
            {
                MessageBox.Show("金额格式不正确");
                return;
            }
            if (!CplHelper.IsSpecLen(txtIdcard.Text, 18))
            {
                MessageBox.Show("身份证格式错误");
                return;
            }
            //*************************
            Communal.h.AllButtonEnabled();
            MODEL.Member m = new MODEL.Member();
            m.MemName   = txtMemName.Text;
            m.MemSex    = BoxSex.Text;
            m.IDCard    = txtIdcard.Text;
            m.MemCardID = txtMemID.Text;
            m.Memtel    = txtTel.Text;

            try { m.Memacount = Convert.ToDouble(txtAccount.Text); }
            catch
            {
                MessageBox.Show("未输入金额!");
                m.Memacount = 0;
            }
            if (AddInfoToCard())
            {
                MessageBox.Show("注册成功");
                m.Registtime   = System.DateTime.Now.ToLongDateString();
                m.operateStaff = MODEL.class1.staff.ID;
                DAL.class1.InputMember(m);
                this.Close();
            }
            else
            {
                MessageBox.Show("请确认将卡添加到读卡器上!");
            }
        }
        private void btn_Click(object sender, EventArgs e)
        {
            switch (state)
            {
            case 1:
            {
                dataGridView1.DataSource = DAL.class1.QueryMembyName(textBox1.Text).Tables[0];
                ChangeName();
                break;
            }

            case 2:
            {
                dataGridView1.DataSource = DAL.class1.QueryMembyMemId(textBox1.Text).Tables[0];
                ChangeName();
                break;
            }

            case 3:
            {
                dataGridView1.DataSource = DAL.class1.QueryMembyDate(dateTimePicker1.Text).Tables[0];
                ChangeName();

                break;
            }

            case 4:
            {
                dataGridView1.DataSource = DAL.class1.QueryMembyTel(textBox1.Text).Tables[0];
                ChangeName();
                break;
            }

            case 5:
            {
                dataGridView1.DataSource = DAL.class1.QueryMembyId(textBox1.Text).Tables[0];
                ChangeName();
                break;
            }

            case 6:
            {
                this.dataGridView1.Columns[0].ReadOnly = true;
                this.dataGridView1.Columns[6].ReadOnly = true;
                this.dataGridView1.Columns[7].ReadOnly = true;
                this.dataGridView1.Columns[8].ReadOnly = true;
                this.dataGridView1.Columns[9].ReadOnly = true;
                for (int i = 0; i < dataGridView1.Rows.Count; i++)
                {
                    MODEL.Member m = new MODEL.Member();

                    m.MemCardID = dataGridView1.Rows[i].Cells[0].Value.ToString();
                    m.MemName   = dataGridView1.Rows[i].Cells[1].Value.ToString();
                    m.MemSex    = dataGridView1.Rows[i].Cells[2].Value.ToString();
                    m.MemPd     = dataGridView1.Rows[i].Cells[3].Value.ToString();
                    m.Memtel    = dataGridView1.Rows[i].Cells[4].Value.ToString();
                    m.IDCard    = dataGridView1.Rows[i].Cells[5].Value.ToString();
                    if (CplHelper.IsDecimal(dataGridView1.Rows[i].Cells[6].Value.ToString()))
                    {
                        m.Memacount = System.Convert.ToDouble(dataGridView1.Rows[i].Cells[6].Value.ToString());
                    }
                    else
                    {
                        MessageBox.Show("金额格式不对!");
                        return;
                    }
                    m.Registtime   = dataGridView1.Rows[i].Cells[7].Value.ToString();
                    m.operateStaff = dataGridView1.Rows[i].Cells[8].Value.ToString();
                    if (CplHelper.IsNull(m.MemName) || CplHelper.IsNull(m.MemSex) ||
                        CplHelper.IsNull(m.MemPd) || CplHelper.IsNull(m.Memtel) ||
                        CplHelper.IsNull(m.IDCard))
                    {
                        MessageBox.Show("信息未输入完全!");
                        return;
                    }
                    if (!CplHelper.IsEmail(m.Memtel))
                    {
                        MessageBox.Show("邮箱格式不对!");
                        return;
                    }
                    if (!CplHelper.IsSpecLen(m.IDCard, 18))
                    {
                        MessageBox.Show("身份证格式不正确!");
                        return;
                    }
                    if (!CplHelper.IsSexRight(m.MemSex))
                    {
                        MessageBox.Show("性别输入不正确!");
                        return;
                    }
                    DAL.class1.UpdateMem(m);
                }
                MessageBox.Show("已修改成功!请在查询界面进行查询");
                break;
            }

            case 7:
            {
                DAL.class1.DeleteMem(dataGridView1.SelectedRows[0].Cells[0].Value.ToString());

                dataGridView1.SelectedRows[0].Cells[0].Value = "停用";
                MessageBox.Show("已将该会员记录停用,双击该记录进行重新注册");
                break;
            }
            }
        }