public void addPriceList(int i, int CurrentPage) { txtSearch.Visible = false; btnAdd.Enabled = false; btBack.Tag = i; btNext.Tag = i; if (this.TotalPage == 0) { this.TotalPage = PriceListSerice.GetTotalProductAndModifire(); } var data = PriceListSerice.GetDataProductAndModifire(CurrentPage); if (i == 5) { this.ResizeTopriceList(); flpMenuList.Controls.Clear(); // txtNameMenuList.Visible = false; ucPriceListTitle.Visible = true; ucPriceListTitle.BackColor = Color.FromArgb(0, 102, 204); ucPriceListTitle.ForeColor = Color.FromArgb(255, 255, 255); ucPriceListTitle.Dock = DockStyle.Fill; foreach (var strPriceList in data) { UCPriceList ucPriceList = new UCPriceList(); ucPriceList.lblPriceNameProduct.Text = strPriceList.NameDesc; ucPriceList.lblPriceSizeProduct.Text = strPriceList.Portions; ucPriceList.lblPriceProduct.Text =money.Format2 (strPriceList.CurrentPrice.ToString()); ucPriceListTitle.Size = new System.Drawing.Size(NewWidthPn2, ucPriceList.Height); //ucPriceList.Dock = DockStyle.Fill; ucPriceList.Tag = strPriceList; ucPriceList.Width = flpMenuList.Width; ucPriceList.Click += ucPriceList_Click; flpMenuList.Controls.Add(ucPriceList); } PriceListModel pricelistmodel = new PriceListModel(); addButtonPriceList(pricelistmodel); } }
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; } }