private void addMenuListDetail(CatalogueModel cata) { //pnDetail.Controls.Clear(); if (cata.CatalogueID > 0) { UCMenu ucMenu = new UCMenu(); if (pnDetail.Controls.Count > 0) { ucMenu = (UCMenu)pnDetail.Controls[0]; } else { ucMenu.Dock = DockStyle.Fill; pnDetail.Controls.Add(ucMenu); } ucMenu.TilteMenu.Text = cata.CatalogueName; ucMenu.txtMenuName.Text = cata.CatalogueName; ucMenu.flpIncludesGroup.Controls.Clear(); ucMenu.addUcMenuGroup(cata.CatalogueID, 1); ucMenu.btnSave.Tag = cata; ucMenu.btnSave.Click += ucMenuList_btnSave_Click; ucMenu.btnRemove.Tag = cata; ucMenu.btnRemove.Click += ucMenuList_btnRemove_Click; ucMenu = (UCMenu)pnDetail.Controls[0]; ucMenu.cbColor.SelectedItem = cata.Color; } else { pnDetail.Controls.Clear(); } }
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 ucTextBoxKeyBoard1_TextChanged(object sender, EventArgs e) { TextBox addNew = (TextBox)sender; int tag = Convert.ToInt32(addNew.Tag); string textSearch = txtSearch.Text; 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: btnAdd.Tag = tag; int index_group = 1; // string[] str = { "COM", "PHO", "HU TIEU", "CHAO", "Coffee", "Tea", "Smoothie" }; if (tag == 2) { var dataCategory = CatalogeService.searchProduct(textSearch, 2).ToList(); flpMenuList.Controls.Clear(); //txtNameMenuList.Visible = true; txtNameMenuList.lblMenuListName.Text = "Group List"; txtNameMenuList.BackColor = Color.FromArgb(0, 102, 204); txtNameMenuList.ForeColor = Color.FromArgb(255, 255, 255); foreach (var item in dataCategory) { UCGroupListItem ucGroupListItem = new UCGroupListItem(); ucGroupListItem.lblGroupListItemName.Text = item.CategoryName; ucGroupListItem.Tag = item; ucGroupListItem.Click += ucGroupListItem_Click; flpMenuList.Controls.Add(ucGroupListItem); index_group++; } } break; case 3: btnAdd.Tag = tag; ResizeToOthder(); int index_item = 1; //string[] str = { "Ice coffee", "VNam Coffee", "Mocha", "Latte", "White Coffee", "Green Tea", "Apple Juice" }; var dataProduct = ProductService.searchProduct(textSearch,3).ToList(); if (tag == 3) { flpMenuList.Controls.Clear(); txtNameMenuList.lblMenuListName.Text = "ItemList"; txtNameMenuList.BackColor = Color.FromArgb(0, 102, 204); txtNameMenuList.ForeColor = Color.FromArgb(255, 255, 255); foreach (var data in dataProduct) { UCItem ucItem = new UCItem(); ucItem.lblItem.Text = data.ProductNameDesc; ucItem.Tag = data; ucItem.Click += ucItem_Click; flpMenuList.Controls.Add(ucItem); index_item++; } } else { flpMenuList.Controls.Clear(); pnDetail.Controls.Clear(); } break; case 4: btnAdd.Tag = tag; ResizeToOthder(); int index_modifier = 1; //string[] str = { "No Sugar", "More Sugar", "More Ice", "Less Ice", "More Milk", "Them Bun", "Them Thit" }; var dataModifire = ModifireService.searchProduct(textSearch,4).ToList(); if (tag == 4) { flpMenuList.Controls.Clear(); //txtNameMenuList.Visible = true; txtNameMenuList.lblMenuListName.Text = "Modifier List"; txtNameMenuList.BackColor = Color.FromArgb(0, 102, 204); txtNameMenuList.ForeColor = Color.FromArgb(255, 255, 255); foreach (var data in dataModifire) { UCModifierItem ucModifierItem = new UCModifierItem(); ucModifierItem.lblModifierItemName.Text = data.ModifireName; ucModifierItem.Tag = data; ucModifierItem.Click += ucModifierItem_Click; flpMenuList.Controls.Add(ucModifierItem); index_modifier++; } } else { flpMenuList.Controls.Clear(); pnDetail.Controls.Clear(); } break; case 5: break; } }