private void btnAdd_Click(object sender, EventArgs e) { pnDetail.Controls.Clear(); Button addNew = (Button)sender; int tag = Convert.ToInt32(addNew.Tag); switch (tag) { case 1: UCMenu ucMenu = new UCMenu(); ucMenu.Dock = DockStyle.Fill; ucMenu.btnSave.Click += ucMenuList_btnSave_Click; ucMenu.btnRemove.Hide(); pnDetail.Controls.Add(ucMenu); break; case 2: UCGroupList ucGroupItem = new UCGroupList(); ucGroupItem.Dock = DockStyle.Fill; ucGroupItem.btnSave.Click += ucGroupList_btnSave_Click; ucGroupItem.btnRemove.Hide(); pnDetail.Controls.Add(ucGroupItem); break; case 3: UCItemList ucItemList = new UCItemList(); ucItemList.Dock = DockStyle.Fill; ucItemList.btnSave.Click += ucItemList_btnSave_Click; ucItemList.btnRemove.Visible = false; ucItemList.btnAddProtions.Visible = false; pnDetail.Controls.Add(ucItemList); break; case 4: UCModifier ucModifier = new UCModifier(); ucModifier.Dock = DockStyle.Fill; ucModifier.btnSave.Click += ucModifier_btnSave_Click; ucModifier.btnRemove.Visible = false; pnDetail.Controls.Add(ucModifier); break; case 5: UCPriceList ucPriceList = new UCPriceList(); ucPriceList.Dock = DockStyle.Fill; pnDetail.Controls.Add(ucPriceList); break; } }
private void addGroupListDetail(CategoryModel cate) { //pnDetail.Controls.Clear(); if (cate.CategoryID > 0) { UCGroupList ucGroupList = new UCGroupList(); if (pnDetail.Controls.Count > 0) { ucGroupList = (UCGroupList)pnDetail.Controls[0]; } else { ucGroupList.Dock = DockStyle.Fill; pnDetail.Controls.Add(ucGroupList); } ucGroupList.lblTilte.Text = cate.CategoryName; ucGroupList.txtGroupNameDesc.Text = cate.CategoryName; ucGroupList.txtGroupNameSort.Text = cate.CategoryNameSort; ucGroupList.btnSave.Tag = cate; ucGroupList.btnSave.Click += ucGroupList_btnSave_Click; ucGroupList.btnRemove.Tag = cate; ucGroupList.btnRemove.Click += ucGroupList_btnRemove_Click; ucGroupList.flpGroup.Controls.Clear(); ucGroupList.addUcMenuGroup(cate.CategoryID, 1); ucGroupList.cbGroupColor.SelectedItem = cate.Color; ucGroupList.cbProductColor.SelectedItem = cate.ProductColor; } else { pnDetail.Controls.Clear(); } }