示例#1
0
        //编辑菜品信息
        private void EditFoodInfo()
        {
            frmEditFood editfood = new frmEditFood();

            editfood.GetFoodTypeList();
            editfood.ComboBox1.Text      = dgFoodList[dgFoodList.CurrentRowIndex, 2].ToString();                        //类别
            editfood.TextBox1.Text       = dgFoodList[dgFoodList.CurrentRowIndex, 0].ToString();                        //编码
            editfood.TextBox2.Text       = dgFoodList[dgFoodList.CurrentRowIndex, 1].ToString();                        //菜品名称
            editfood.TextBox3.Text       = dgFoodList[dgFoodList.CurrentRowIndex, 12].ToString();                       //拼音码
            editfood.ComboBox2.Text      = dgFoodList[dgFoodList.CurrentRowIndex, 3].ToString();                        //单位
            editfood.NumericUpDown1.Text = dgFoodList[dgFoodList.CurrentRowIndex, 5].ToString();                        //单价
            editfood.NumericUpDown5.Text = dgFoodList[dgFoodList.CurrentRowIndex, 6].ToString();                        //成本价
            editfood.NumericUpDown2.Text = dgFoodList[dgFoodList.CurrentRowIndex, 7].ToString();                        //提成

            editfood.CheckBox3.Checked   = dgFoodList[dgFoodList.CurrentRowIndex, 8].ToString() == "1"?true:false;      //是否为特价菜
            editfood.CheckBox4.Checked   = dgFoodList[dgFoodList.CurrentRowIndex, 10].ToString() == "1" ? true : false; //是否为时价菜
            editfood.CheckBox1.Checked   = dgFoodList[dgFoodList.CurrentRowIndex, 13].ToString() == "1" ? true : false; //不优惠
            editfood.CheckBox2.Checked   = dgFoodList[dgFoodList.CurrentRowIndex, 14].ToString() == "1" ? true : false; //不出售
            editfood.NumericUpDown6.Text = dgFoodList[dgFoodList.CurrentRowIndex, 15].ToString();                       //剩余数量
            editfood.CheckBox5.Checked   = dgFoodList[dgFoodList.CurrentRowIndex, 16].ToString() == "1" ? true : false; //前台定制菜品

            if (editfood.CheckBox3.Checked)
            {
                editfood.NumericUpDown3.Text    = dgFoodList[dgFoodList.CurrentRowIndex, 9].ToString();              //特价价格
                editfood.NumericUpDown3.Enabled = true;
            }

            if (editfood.CheckBox4.Checked)
            {
                editfood.NumericUpDown4.Text    = dgFoodList[dgFoodList.CurrentRowIndex, 11].ToString();              //时价价格
                editfood.NumericUpDown4.Enabled = true;
            }

            editfood.frmMode     = 2;                                                    //修改记录
            editfood.Text        = "修改菜品信息";
            editfood.OldFoodCode = dgFoodList[dgFoodList.CurrentRowIndex, 0].ToString(); //保存原始编号
            editfood.OldFoodName = dgFoodList[dgFoodList.CurrentRowIndex, 1].ToString(); //保存原始名称
            //检测是否直接修改成本价


            editfood.ShowDialog();
            if (editfood.DialogResult == DialogResult.OK)
            {
                LoadFoodList();
            }
        }
示例#2
0
        private void ToolBar1_ButtonClick(System.Object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
        {
            switch (ToolBar1.Buttons.IndexOf(e.Button))
            {
            case 0:                     //添加数据
                frmEditFood EditFood_1 = new frmEditFood();
                EditFood_1.GetFoodTypeList();

                EditFood_1.frmMode = 1;                         //添加记录
                EditFood_1.Text    = "添加菜品信息";

                EditFood_1.ShowDialog();
                if (EditFood_1.DialogResult == DialogResult.OK)
                {
                    LoadFoodList();
                }
                break;

            case 1:                     //修改数据
                if (!(dgFoodList.CurrentRowIndex < 0))
                {
                    EditFoodInfo();
                }
                break;

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

            case 4:                     //查询数据
                frmEditFood EditFood = new frmEditFood();
                EditFood.GetFoodTypeList();

                EditFood.frmMode = 3;                         //查询数据
                EditFood.Text    = "查询菜品信息";

                EditFood.ShowDialog();
                if (EditFood.DialogResult == DialogResult.OK)
                {
                    SearchFood(EditFood.TextBox1.Text, EditFood.ComboBox1.Text, EditFood.TextBox2.Text, EditFood.TextBox3.Text, EditFood.CheckBox3.Checked, EditFood.CheckBox4.Checked, EditFood.CheckBox1.Checked, EditFood.CheckBox2.Checked);
                }
                break;

            case 6:                     //做法
                if (!(dgFoodList.CurrentRowIndex < 0))
                {
                    frmEditFoodOperandi frmfoodop = new frmEditFoodOperandi();
                    frmfoodop.frmMode     = 2;                         //2=编辑当前菜品做法
                    frmfoodop.foodcode    = dgFoodList[dgFoodList.CurrentRowIndex, 0].ToString();
                    frmfoodop.Label4.Text = "菜品名称:" + "\r\n" + dgFoodList[dgFoodList.CurrentRowIndex, 1].ToString();
                    frmfoodop.ShowDialog();
                }
                break;

            case 7:                     //口味
                if (!(dgFoodList.CurrentRowIndex < 0))
                {
                    frmEditFoodTaste frmfoodtst = new frmEditFoodTaste();
                    frmfoodtst.frmMode     = 2;                         //2=编辑当前菜品口味
                    frmfoodtst.foodcode    = dgFoodList[dgFoodList.CurrentRowIndex, 0].ToString();
                    frmfoodtst.Label4.Text = "菜品名称:" + "\r\n" + dgFoodList[dgFoodList.CurrentRowIndex, 1].ToString();
                    frmfoodtst.ShowDialog();
                }
                break;

            case 9:                     //成本卡
                if (!(dgFoodList.CurrentRowIndex < 0))
                {
                    frmFoodCost frmfoodcst = new frmFoodCost();
                    frmfoodcst.foodcode    = dgFoodList[dgFoodList.CurrentRowIndex, 0].ToString();
                    frmfoodcst.Label1.Text = "菜品名称:" + dgFoodList[dgFoodList.CurrentRowIndex, 1].ToString();
                    frmfoodcst.ShowDialog();
                }
                break;

            case 11:                     //调价
                if (!(dgFoodList.CurrentRowIndex < 0))
                {
                    frmAdjustFoodPrice frmadjfoodprice = new frmAdjustFoodPrice();
                    frmadjfoodprice.ShowDialog();
                    if (frmadjfoodprice.DialogResult == DialogResult.OK)
                    {
                        if (frmadjfoodprice.RadioButton1.Checked)                                 //上调
                        {
                            if (UpdateFoodsPrice("+", (double)frmadjfoodprice.NumericUpDown1.Value))
                            {
                                LoadFoodList();
                            }
                        }
                        else
                        {
                            if (UpdateFoodsPrice("-", (double)frmadjfoodprice.NumericUpDown1.Value))
                            {
                                LoadFoodList();
                            }
                        }
                    }
                }
                break;

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

            case 15:                     //关闭
                this.Close();
                break;
            }
        }
示例#3
0
        private void ToolBar1_ButtonClick(System.Object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
        {
            switch (ToolBar1.Buttons.IndexOf(e.Button))
            {
                case 0: //添加数据
                    frmEditFood EditFood_1 = new frmEditFood();
                    EditFood_1.GetFoodTypeList();

                    EditFood_1.frmMode = 1; //添加记录
                    EditFood_1.Text = "添加菜品信息";

                    EditFood_1.ShowDialog();
                    if (EditFood_1.DialogResult == DialogResult.OK)
                    {
                        LoadFoodList();
                    }
                    break;
                case 1: //修改数据
                    if (! (dgFoodList.CurrentRowIndex < 0))
                    {
                        EditFoodInfo();
                    }
                    break;
                case 2: //删除当前数据
                    if (! (dgFoodList.CurrentRowIndex < 0))
                    {
                        if (MessageBox.Show("确定要删除当前选中的编号为 " + dgFoodList[dgFoodList.CurrentRowIndex, 0].ToString().Trim() + " 的菜品吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                        {
                            //'删除操作
                            if (DelFood(dgFoodList[dgFoodList.CurrentRowIndex, 0].ToString()))
                            {
                                LoadFoodList();
                            }
                        }
                    }
                    break;
                case 4: //查询数据
                    frmEditFood EditFood = new frmEditFood();
                    EditFood.GetFoodTypeList();

                    EditFood.frmMode = 3; //查询数据
                    EditFood.Text = "查询菜品信息";

                    EditFood.ShowDialog();
                    if (EditFood.DialogResult == DialogResult.OK)
                    {
                        SearchFood(EditFood.TextBox1.Text, EditFood.ComboBox1.Text, EditFood.TextBox2.Text, EditFood.TextBox3.Text, EditFood.CheckBox3.Checked, EditFood.CheckBox4.Checked, EditFood.CheckBox1.Checked, EditFood.CheckBox2.Checked);
                    }
                    break;
                case 6: //做法
                    if (! (dgFoodList.CurrentRowIndex < 0))
                    {
                        frmEditFoodOperandi frmfoodop = new frmEditFoodOperandi();
                        frmfoodop.frmMode = 2; //2=编辑当前菜品做法
                        frmfoodop.foodcode = dgFoodList[dgFoodList.CurrentRowIndex, 0].ToString();
                        frmfoodop.Label4.Text = "菜品名称:" + "\r\n" + dgFoodList[dgFoodList.CurrentRowIndex, 1].ToString();
                        frmfoodop.ShowDialog();
                    }
                    break;
                case 7: //口味
                    if (! (dgFoodList.CurrentRowIndex < 0))
                    {
                        frmEditFoodTaste frmfoodtst = new frmEditFoodTaste();
                        frmfoodtst.frmMode = 2; //2=编辑当前菜品口味
                        frmfoodtst.foodcode = dgFoodList[dgFoodList.CurrentRowIndex, 0].ToString();
                        frmfoodtst.Label4.Text = "菜品名称:" + "\r\n" + dgFoodList[dgFoodList.CurrentRowIndex, 1].ToString();
                        frmfoodtst.ShowDialog();
                    }
                    break;
                case 9: //成本卡
                    if (! (dgFoodList.CurrentRowIndex < 0))
                    {
                        frmFoodCost frmfoodcst = new frmFoodCost();
                        frmfoodcst.foodcode = dgFoodList[dgFoodList.CurrentRowIndex, 0].ToString();
                        frmfoodcst.Label1.Text = "菜品名称:" + dgFoodList[dgFoodList.CurrentRowIndex, 1].ToString();
                        frmfoodcst.ShowDialog();
                    }
                    break;
                case 11: //调价
                    if (! (dgFoodList.CurrentRowIndex < 0))
                    {
                        frmAdjustFoodPrice frmadjfoodprice = new frmAdjustFoodPrice();
                        frmadjfoodprice.ShowDialog();
                        if (frmadjfoodprice.DialogResult == DialogResult.OK)
                        {
                            if (frmadjfoodprice.RadioButton1.Checked) //上调
                            {
                                if (UpdateFoodsPrice("+", (double) frmadjfoodprice.NumericUpDown1.Value))
                                {
                                    LoadFoodList();
                                }
                            }
                            else
                            {
                                if (UpdateFoodsPrice("-", (double) frmadjfoodprice.NumericUpDown1.Value))
                                {
                                    LoadFoodList();
                                }
                            }
                        }
                    }
                    break;
                case 13: //打印
                    if (MessageBox.Show("确定要进行打印操作吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                    {
                        if (! PrintReport(CurrentFoodLstSqlCode))
                        {
                            MessageBox.Show("打印失败!如果问题依然存在请联系系统管理员。");
                        }
                    }
                    break;
                case 15: //关闭
                    this.Close();
                    break;
            }
        }
示例#4
0
        //编辑菜品信息
        private void EditFoodInfo()
        {
            frmEditFood editfood = new frmEditFood();
            editfood.GetFoodTypeList();
            editfood.ComboBox1.Text = dgFoodList[dgFoodList.CurrentRowIndex, 2].ToString(); //类别
            editfood.TextBox1.Text = dgFoodList[dgFoodList.CurrentRowIndex, 0].ToString(); //编码
            editfood.TextBox2.Text = dgFoodList[dgFoodList.CurrentRowIndex, 1].ToString(); //菜品名称
            editfood.TextBox3.Text = dgFoodList[dgFoodList.CurrentRowIndex, 12].ToString(); //拼音码
            editfood.ComboBox2.Text = dgFoodList[dgFoodList.CurrentRowIndex, 3].ToString(); //单位
            editfood.NumericUpDown1.Text = dgFoodList[dgFoodList.CurrentRowIndex, 5].ToString(); //单价
            editfood.NumericUpDown5.Text = dgFoodList[dgFoodList.CurrentRowIndex, 6].ToString(); //成本价
            editfood.NumericUpDown2.Text = dgFoodList[dgFoodList.CurrentRowIndex, 7].ToString(); //提成

            editfood.CheckBox3.Checked = dgFoodList[dgFoodList.CurrentRowIndex, 8].ToString()=="1"?true:false; //是否为特价菜
            editfood.CheckBox4.Checked = dgFoodList[dgFoodList.CurrentRowIndex, 10].ToString() == "1" ? true : false; //是否为时价菜
            editfood.CheckBox1.Checked = dgFoodList[dgFoodList.CurrentRowIndex, 13].ToString() == "1" ? true : false; //不优惠
            editfood.CheckBox2.Checked = dgFoodList[dgFoodList.CurrentRowIndex, 14].ToString() == "1" ? true : false; //不出售
            editfood.NumericUpDown6.Text = dgFoodList[dgFoodList.CurrentRowIndex, 15].ToString(); //剩余数量
            editfood.CheckBox5.Checked = dgFoodList[dgFoodList.CurrentRowIndex, 16].ToString() == "1" ? true : false; //前台定制菜品

            if (editfood.CheckBox3.Checked)
            {
                editfood.NumericUpDown3.Text = dgFoodList[dgFoodList.CurrentRowIndex, 9].ToString(); //特价价格
                editfood.NumericUpDown3.Enabled = true;
            }

            if (editfood.CheckBox4.Checked)
            {
                editfood.NumericUpDown4.Text = dgFoodList[dgFoodList.CurrentRowIndex, 11].ToString(); //时价价格
                editfood.NumericUpDown4.Enabled = true;
            }

            editfood.frmMode = 2; //修改记录
            editfood.Text = "修改菜品信息";
            editfood.OldFoodCode = dgFoodList[dgFoodList.CurrentRowIndex, 0].ToString(); //保存原始编号
            editfood.OldFoodName = dgFoodList[dgFoodList.CurrentRowIndex, 1].ToString(); //保存原始名称
            //检测是否直接修改成本价

            editfood.ShowDialog();
            if (editfood.DialogResult == DialogResult.OK)
            {
                LoadFoodList();
            }
        }