示例#1
0
        private void ToolBar1_ButtonClick(System.Object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
        {
            switch (ToolBar1.Buttons.IndexOf(e.Button))
            {
                case 0: //启用
                    if (! (dgCard.CurrentRowIndex < 0))
                    {
                        if (MessageBox.Show("确定要启用 " + dgCard[dgCard.CurrentRowIndex, 0] + " 号会员卡?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                        {
                            if (EnableCard(dgCard[dgCard.CurrentRowIndex, 0].ToString()))
                            {
                                MessageBox.Show("启用成功。");
                                LoadCardList();
                            }
                        }
                    }
                    break;

                case 1: //暂停
                    if (! (dgCard.CurrentRowIndex < 0))
                    {
                        if (MessageBox.Show("确定要暂停使用 " + dgCard[dgCard.CurrentRowIndex, 0] + " 号会员卡?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                        {
                            if (PauseCard(dgCard[dgCard.CurrentRowIndex, 0].ToString()))
                            {
                                MessageBox.Show("暂停使用成功。");
                                LoadCardList();
                            }
                        }
                    }
                    break;

                case 2: //废止
                    if (! (dgCard.CurrentRowIndex < 0))
                    {
                        if (MessageBox.Show("确定要废止 " + dgCard[dgCard.CurrentRowIndex, 0] + " 号会员卡?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                        {
                            if (MessageBox.Show("警告:一旦废止会员卡,您将无法再启用它!请谨慎操作! " + "\r\n"+ "确实要废止 " + dgCard[dgCard.CurrentRowIndex, 0] + " 号会员卡吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                            {
                                if (DisableCard(dgCard[dgCard.CurrentRowIndex, 0].ToString()))
                                {
                                    MessageBox.Show("废止操作成功。");
                                    LoadCardList();
                                }
                            }
                        }
                    }
                    break;

                case 4: //打折
                    if (! (dgCard.CurrentRowIndex < 0))
                    {
                        frmClubDiscount frmcd = new frmClubDiscount();
                        frmcd.cardcode = dgCard[dgCard.CurrentRowIndex, 0].ToString();
                        frmcd.ShowDialog();
                        if (frmcd.DialogResult == DialogResult.OK)
                        {
                            LoadCardList();
                        }
                    }
                    break;

                case 5: //续存
                    if (! (dgCard.CurrentRowIndex < 0))
                    {
                        frmCardSupply frmds = new frmCardSupply();
                        frmds.cardcode = dgCard[dgCard.CurrentRowIndex, 0].ToString();
                        frmds.ShowDialog();
                        if (frmds.DialogResult == DialogResult.OK)
                        {
                            LoadCardList();
                        }
                    }
                    break;

                case 6: //更改密码
                    if (! (dgCard.CurrentRowIndex < 0))
                    {
                        frmCardPsw frmcp = new frmCardPsw();
                        frmcp.cardcode = dgCard[dgCard.CurrentRowIndex, 0].ToString();
                        frmcp.ShowDialog();
                        if (frmcp.DialogResult == DialogResult.OK)
                        {
                            LoadCardList();
                        }
                    }
                    break;

                case 8: //删除当前数据
                    if (! (dgCard.CurrentRowIndex < 0))
                    {
                        if (MessageBox.Show("确定要删除当前选中的编号为 " + dgCard[dgCard.CurrentRowIndex, 0].ToString().Trim() + " 的会员卡吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                        {
                            //删除操作
                            if (DelCard(dgCard[dgCard.CurrentRowIndex, 0].ToString()))
                            {
                                LoadCardList();
                            }
                        }
                    }
                    break;
                case 10:
                    frmCardSc frmcsc = new frmCardSc();
                    frmcsc.ShowDialog();
                    if (frmcsc.DialogResult == DialogResult.OK)
                    {
                        SearchCard(frmcsc.TextBox1.Text, System.Convert.ToString(frmcsc.ComboBox1.SelectedIndex + 1), frmcsc.TextBox2.Text);
                    }
                    break;
                case 11:
                    if (MessageBox.Show("确定要进行打印操作吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                    {
                        if (! PrintReport(CurrentCardLstSqlCode))
                        {
                            MessageBox.Show("打印失败!如果问题依然存在请联系系统管理员。");
                        }
                    }
                    break;
                case 13:
                    this.Close();
                    break;
            }
        }
示例#2
0
        private void ToolBar1_ButtonClick(System.Object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
        {
            switch (ToolBar1.Buttons.IndexOf(e.Button))
            {
            case 0:                     //启用
                if (!(dgCard.CurrentRowIndex < 0))
                {
                    if (MessageBox.Show("确定要启用 " + dgCard[dgCard.CurrentRowIndex, 0] + " 号会员卡?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                    {
                        if (EnableCard(dgCard[dgCard.CurrentRowIndex, 0].ToString()))
                        {
                            MessageBox.Show("启用成功。");
                            LoadCardList();
                        }
                    }
                }
                break;

            case 1:                     //暂停
                if (!(dgCard.CurrentRowIndex < 0))
                {
                    if (MessageBox.Show("确定要暂停使用 " + dgCard[dgCard.CurrentRowIndex, 0] + " 号会员卡?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                    {
                        if (PauseCard(dgCard[dgCard.CurrentRowIndex, 0].ToString()))
                        {
                            MessageBox.Show("暂停使用成功。");
                            LoadCardList();
                        }
                    }
                }
                break;

            case 2:                     //废止
                if (!(dgCard.CurrentRowIndex < 0))
                {
                    if (MessageBox.Show("确定要废止 " + dgCard[dgCard.CurrentRowIndex, 0] + " 号会员卡?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                    {
                        if (MessageBox.Show("警告:一旦废止会员卡,您将无法再启用它!请谨慎操作! " + "\r\n" + "确实要废止 " + dgCard[dgCard.CurrentRowIndex, 0] + " 号会员卡吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                        {
                            if (DisableCard(dgCard[dgCard.CurrentRowIndex, 0].ToString()))
                            {
                                MessageBox.Show("废止操作成功。");
                                LoadCardList();
                            }
                        }
                    }
                }
                break;

            case 4:                     //打折
                if (!(dgCard.CurrentRowIndex < 0))
                {
                    frmClubDiscount frmcd = new frmClubDiscount();
                    frmcd.cardcode = dgCard[dgCard.CurrentRowIndex, 0].ToString();
                    frmcd.ShowDialog();
                    if (frmcd.DialogResult == DialogResult.OK)
                    {
                        LoadCardList();
                    }
                }
                break;

            case 5:                     //续存
                if (!(dgCard.CurrentRowIndex < 0))
                {
                    frmCardSupply frmds = new frmCardSupply();
                    frmds.cardcode = dgCard[dgCard.CurrentRowIndex, 0].ToString();
                    frmds.ShowDialog();
                    if (frmds.DialogResult == DialogResult.OK)
                    {
                        LoadCardList();
                    }
                }
                break;

            case 6:                     //更改密码
                if (!(dgCard.CurrentRowIndex < 0))
                {
                    frmCardPsw frmcp = new frmCardPsw();
                    frmcp.cardcode = dgCard[dgCard.CurrentRowIndex, 0].ToString();
                    frmcp.ShowDialog();
                    if (frmcp.DialogResult == DialogResult.OK)
                    {
                        LoadCardList();
                    }
                }
                break;

            case 8:                     //删除当前数据
                if (!(dgCard.CurrentRowIndex < 0))
                {
                    if (MessageBox.Show("确定要删除当前选中的编号为 " + dgCard[dgCard.CurrentRowIndex, 0].ToString().Trim() + " 的会员卡吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                    {
                        //删除操作
                        if (DelCard(dgCard[dgCard.CurrentRowIndex, 0].ToString()))
                        {
                            LoadCardList();
                        }
                    }
                }
                break;

            case 10:
                frmCardSc frmcsc = new frmCardSc();
                frmcsc.ShowDialog();
                if (frmcsc.DialogResult == DialogResult.OK)
                {
                    SearchCard(frmcsc.TextBox1.Text, System.Convert.ToString(frmcsc.ComboBox1.SelectedIndex + 1), frmcsc.TextBox2.Text);
                }
                break;

            case 11:
                if (MessageBox.Show("确定要进行打印操作吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                {
                    if (!PrintReport(CurrentCardLstSqlCode))
                    {
                        MessageBox.Show("打印失败!如果问题依然存在请联系系统管理员。");
                    }
                }
                break;

            case 13:
                this.Close();
                break;
            }
        }