protected void btnSearch_Click(object sender, EventArgs e) { lblMsg.Text = ""; string selectedRole = ddlRole.SelectedValue; string selectedMenuFunc = ddlMenuFunc.SelectedValue; IList<RoleMenuShowVO> showVOList = new List<RoleMenuShowVO>(); if (!string.IsNullOrEmpty(selectedRole)) { LoginRole role = authService.myService.DaoGetVOById<LoginRole>(int.Parse(selectedRole)); IList<MenuFunc> selectedMenuFuncList; if (selectedMenuFunc.Equals("0")) { selectedMenuFuncList = authService.GetNotTopMenuFunc(); } else { selectedMenuFuncList = authService.GetMenuFuncByParentId(int.Parse(selectedMenuFunc)); } foreach (MenuFunc menu in selectedMenuFuncList) { RoleMenuShowVO showVO = new RoleMenuShowVO(); showVO.Id = menu.Id; showVO.Name = menu.MenuFuncName; showVO.No = menu.Note; if (CollectionUtil.ContainValue<MenuFunc>(role.MenuFuncs, "Id", menu.Id.ToString())) { showVO.IsAuth = true; } else { showVO.IsAuth = false; } showVOList.Add(showVO); } gvAuth.DataSource = showVOList; gvAuth.DataBind(); } }
public IList<RoleMenuShowVO> GetGridViewRow(string selectedRole, string selectedMenuFunc) { IList<RoleMenuShowVO> showVOList = new List<RoleMenuShowVO>(); log.Debug("selectedRole=" + selectedRole); log.Debug("selectedMenuFunc=" + selectedMenuFunc); LoginRole role = authService.myService.DaoGetVOById<LoginRole>(int.Parse(selectedRole)); IList<MenuFunc> selectedMenuFuncList; if (selectedMenuFunc.Equals("0")) { selectedMenuFuncList = authService.GetNotTopMenuFunc(); } else { selectedMenuFuncList = authService.GetMenuFuncByParentId(int.Parse(selectedMenuFunc)); } foreach (MenuFunc menu in selectedMenuFuncList) { RoleMenuShowVO showVO = new RoleMenuShowVO(); showVO.Id = menu.Id; showVO.Name = menu.MenuFuncName; showVO.No = menu.Note; if (role.MenuFuncs.Contains(menu)) { showVO.IsAuth = true; } else { showVO.IsAuth = false; } showVOList.Add(showVO); } return showVOList; }