Exemplo n.º 1
0
        private void 新增菜品ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode node     = treeView1.SelectedNode;
            var      catagory = node.Tag as Data.Catagory;

            if (catagory == null)
            {
                MessageBox.Show("请先选择一个菜品分类", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            FormMenuEdit form = new FormMenuEdit(catagory.id);

            form.Text = "新增菜品";
            var dr = form.ShowDialog();

            if (dr == DialogResult.OK)
            {
                RefreshMenu(catagory.id);
            }
        }
Exemplo n.º 2
0
        private void 修改菜品ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count <= 0)
            {
                MessageBox.Show("请先选择一个菜品", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            var          menu = dataGridView1.SelectedRows[0].DataBoundItem as Data.Menu;
            FormMenuEdit form = new FormMenuEdit(menu);

            form.Text = "修改菜品";
            var dr = form.ShowDialog();

            if (dr == DialogResult.OK)
            {
                TreeNode node     = treeView1.SelectedNode;
                var      catagory = node.Tag as Data.Catagory;
                if (catagory != null)
                {
                    RefreshMenu(catagory.id);
                }
            }
        }