private List <CTLoaiMon_LoaiToppingDTO> LayDanhSachCheckBoxLoaiTopping(bool themLoaiMon) { int maLoaiMon; if (themLoaiMon) { maLoaiMon = LoaiMonBUS.LayMaLoaiMonMoiNhat() + 1; } else { maLoaiMon = Convert.ToInt32(txtMaLoaiMon.Text); } List <CTLoaiMon_LoaiToppingDTO> lsLoaiMon_LoaiTopping = new List <CTLoaiMon_LoaiToppingDTO>(); foreach (Control ctrl in gpbLoaiTopping.Controls) { if (ctrl.GetType() == typeof(MetroCheckBox)) { if (((MetroCheckBox)ctrl).Checked) { CTLoaiMon_LoaiToppingDTO loaiMon_LoaiTopping = new CTLoaiMon_LoaiToppingDTO(); LoaiToppingDTO loaiTopping = (LoaiToppingDTO)ctrl.Tag; loaiMon_LoaiTopping.MaLoaiMon = maLoaiMon; loaiMon_LoaiTopping.MaLoaiTopping = loaiTopping.MaLoaiTopping; lsLoaiMon_LoaiTopping.Add(loaiMon_LoaiTopping); } } } return(lsLoaiMon_LoaiTopping); }
private void LamMoiLoaiMon(bool state = true) { txtMaLoaiMon.Text = LoaiMonBUS.LayMaLoaiMonMoiNhat() + 1 + ""; txtTenLoaiMon.Text = string.Empty; chkDoUong.Checked = false; foreach (Control ctrl in gpbLoaiTopping.Controls) { if (ctrl.GetType() == typeof(MetroCheckBox)) { ((MetroCheckBox)ctrl).Checked = false; } } btnThemLoaiMon.Enabled = state; btnXoaLoaiMon.Enabled = !state; btnSuaLoaiMon.Enabled = !state; btnKhoiPhucLoaiMon.Enabled = !state; }