private void Search() { List <Expression <Func <AuthorityGroup, bool> > > expressions = new List <Expression <Func <AuthorityGroup, bool> > >(); if (!chkAllStatus.Checked) { GlobalConstants.StatusValue statusValue; Enum.TryParse <GlobalConstants.StatusValue>((chkUsing.Checked ? GlobalConstants.StatusValue.Using.ToString() : GlobalConstants.StatusValue.NoUse.ToString()), out statusValue); expressions.Add(_ => _.Status == statusValue); } dgvDuLieu.DataSource = _authorityGroupRepository.Find(expressions); Control(); }
private void LoadAuthority() { var authorityGroups = _authorityGroupRepository.Find(_ => _.Status == GlobalConstants.StatusValue.Using).OrderBy(_ => _.Sort); var userAuthoritys = _userAuthorityRepository.Find(_ => _.UserId.Equals(_id)); dgvDuLieu.Rows.Clear(); int check = 0; foreach (var authorityGroup in authorityGroups) { check = 0; foreach (var programFunctionAuthority in userAuthoritys) { if (programFunctionAuthority.AuthorityGroupId == authorityGroup.Id) { check = 1; break; } } object[] rowAdd = { check, authorityGroup.Id, authorityGroup.AuthorityGroupName }; dgvDuLieu.Rows.Add(rowAdd); } }