Beispiel #1
0
        private void ToolBar1_ButtonClick(System.Object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
        {
            switch (ToolBar1.Buttons.IndexOf(e.Button))
            {
            case 0:                     //添加数据
                frmEditTable EditTable_1 = new frmEditTable();
                EditTable_1.GetTableTypeList();

                EditTable_1.frmMode = 1;                         //添加记录
                EditTable_1.Text    = "添加桌台";

                EditTable_1.ShowDialog();
                if (EditTable_1.DialogResult == DialogResult.OK)
                {
                    LoadTableList();
                }
                break;

            case 1:                     //修改数据
                if (!(dgTableList.CurrentRowIndex < 0))
                {
                    if (rms_var.GetTableStatus(dgTableList[dgTableList.CurrentRowIndex, 1].ToString()) == 0)     //桌台空闲
                    {
                        EditTableInfo();
                    }
                    else
                    {
                        MessageBox.Show("桌台不是空闲状态,您不能编辑该桌台。");
                    }
                }
                break;

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

            case 4:                     //查询数据
                frmEditTable EditTable = new frmEditTable();
                EditTable.GetTableTypeList();

                EditTable.frmMode = 3;                         //查询数据
                EditTable.Text    = "查询桌台信息";

                EditTable.ShowDialog();
                if (EditTable.DialogResult == DialogResult.OK)
                {
                    SearchTable(EditTable.ComboBox1.Text, EditTable.TextBox1.Text, EditTable.TextBox2.Text);
                }
                break;

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

            case 8:                     //关闭
                this.Close();
                break;
            }
        }
Beispiel #2
0
        //编辑桌台信息
        private void EditTableInfo()
        {
            frmEditTable EditTable = new frmEditTable();

            EditTable.GetTableTypeList();

            //一般信息
            EditTable.ComboBox1.Text      = dgTableList[dgTableList.CurrentRowIndex, 0].ToString();       //类别
            EditTable.TextBox1.Text       = dgTableList[dgTableList.CurrentRowIndex, 1].ToString();       //桌台编码
            EditTable.TextBox2.Text       = dgTableList[dgTableList.CurrentRowIndex, 2].ToString();       //桌台名称
            EditTable.NumericUpDown4.Text = dgTableList[dgTableList.CurrentRowIndex, 3].ToString();       //最大载客数
            EditTable.NumericUpDown5.Text = dgTableList[dgTableList.CurrentRowIndex, 4].ToString();       //最低消费
            EditTable.NumericUpDown6.Text = dgTableList[dgTableList.CurrentRowIndex, 5].ToString();       //房费/附加费

            //服务费
            EditTable.CheckBox2.Checked = dgTableList[dgTableList.CurrentRowIndex, 6].ToString() == "1" ? true : false; //是否收取服务费
            if (EditTable.CheckBox2.Checked)
            {
                EditTable.RadioButton1.Enabled = true;
                EditTable.RadioButton2.Enabled = true;
                //检测服务费收取方式
                //服务费收取方式
                if (dgTableList[dgTableList.CurrentRowIndex, 7].ToString() == "0")                 //固定服务费
                {
                    EditTable.RadioButton1.Checked = true;
                    EditTable.RadioButton2.Checked = false;
                }
                else
                {
                    EditTable.RadioButton1.Checked = false;
                    EditTable.RadioButton2.Checked = true;
                }
                if (EditTable.RadioButton1.Checked)
                {
                    EditTable.NumericUpDown7.Enabled = true;
                    EditTable.NumericUpDown8.Enabled = false;
                    EditTable.NumericUpDown7.Text    = dgTableList[dgTableList.CurrentRowIndex, 8].ToString();
                }
                else
                {
                    EditTable.NumericUpDown7.Enabled = false;
                    EditTable.NumericUpDown8.Enabled = true;
                    EditTable.NumericUpDown8.Text    = dgTableList[dgTableList.CurrentRowIndex, 8].ToString();
                }
            }
            else
            {
                EditTable.RadioButton1.Enabled   = false;
                EditTable.RadioButton2.Enabled   = false;
                EditTable.NumericUpDown7.Enabled = false;
                EditTable.NumericUpDown8.Enabled = false;
            }

            //超时费
            EditTable.CheckBox1.Checked = dgTableList[dgTableList.CurrentRowIndex, 9].ToString() == "1" ? true : false; //是否收取超时费
            if (EditTable.CheckBox1.Checked)
            {
                EditTable.NumericUpDown1.Enabled = true;
                EditTable.ComboBox2.Enabled      = true;
                //检测超时费收取方式
                //超时费收取方式
                EditTable.NumericUpDown1.Text = dgTableList[dgTableList.CurrentRowIndex, 10].ToString();
                if (Convert.ToInt32(dgTableList[dgTableList.CurrentRowIndex, 11].ToString()) == 0)                 //分钟
                {
                    EditTable.ComboBox2.Text = "分钟";
                }
                else if (Convert.ToInt32(dgTableList[dgTableList.CurrentRowIndex, 11].ToString()) == 1)                 //小时
                {
                    EditTable.ComboBox2.Text = "小时";
                }

                if (dgTableList[dgTableList.CurrentRowIndex, 12].ToString() == "0")                 //按超时收取
                {
                    EditTable.RadioButton3.Checked = true;
                    EditTable.RadioButton4.Checked = false;
                }
                else
                {
                    EditTable.RadioButton3.Checked = false;
                    EditTable.RadioButton4.Checked = true;
                }
                if (EditTable.RadioButton3.Checked)
                {
                    EditTable.ComboBox3.Enabled = true;

                    if (Convert.ToInt32(dgTableList[dgTableList.CurrentRowIndex, 13].ToString()) == 0)                     //分钟
                    {
                        EditTable.ComboBox3.Text = "分钟";
                    }
                    else if (Convert.ToInt32(dgTableList[dgTableList.CurrentRowIndex, 13].ToString()) == 1)                     //小时
                    {
                        EditTable.ComboBox3.Text = "小时";
                    }

                    EditTable.NumericUpDown2.Enabled = true;
                    EditTable.NumericUpDown2.Text    = dgTableList[dgTableList.CurrentRowIndex, 14].ToString();
                    EditTable.ComboBox4.Enabled      = false;
                    EditTable.NumericUpDown3.Enabled = false;
                }
                else
                {
                    EditTable.ComboBox4.Enabled = true;

                    if (Convert.ToInt32(dgTableList[dgTableList.CurrentRowIndex, 14].ToString()) == 1)                     //分钟
                    {
                        EditTable.ComboBox3.Text = "分钟";
                    }
                    else if (Convert.ToInt32(dgTableList[dgTableList.CurrentRowIndex, 14].ToString()) == 1)                     //小时
                    {
                        EditTable.ComboBox3.Text = "小时";
                    }

                    EditTable.NumericUpDown3.Enabled = true;
                    EditTable.NumericUpDown3.Text    = dgTableList[dgTableList.CurrentRowIndex, 14].ToString();
                    EditTable.ComboBox3.Enabled      = false;
                    EditTable.NumericUpDown2.Enabled = false;
                }
            }
            else
            {
                EditTable.NumericUpDown1.Enabled = false;
                EditTable.NumericUpDown2.Enabled = false;
                EditTable.NumericUpDown3.Enabled = false;
                EditTable.ComboBox2.Enabled      = false;
                EditTable.ComboBox3.Enabled      = false;
                EditTable.ComboBox4.Enabled      = false;
                EditTable.RadioButton3.Enabled   = false;
                EditTable.RadioButton4.Enabled   = false;
            }
            //此处添加开关和呼叫器信息


            EditTable.frmMode      = 2;                                                      //修改记录
            EditTable.Text         = "修改桌台信息";
            EditTable.OldTablecode = dgTableList[dgTableList.CurrentRowIndex, 1].ToString(); //保存原始编号
            EditTable.oldTablename = dgTableList[dgTableList.CurrentRowIndex, 2].ToString(); //保存原始名称
            EditTable.ShowDialog();
            if (EditTable.DialogResult == DialogResult.OK)
            {
                LoadTableList();
            }
        }