private void Search() { _projectDataContext = new ProjectDataContext(); _programFunctionMasterRepository = new ProgramFunctionMasterRepository(_projectDataContext); dgvDuLieu.DataSource = _programFunctionMasterRepository.GetAll().OrderBy(_ => _.ProgramName); Control(); }
private void LoadProgramFunction() { var programFunctionMasters = _programFunctionMasterRepository.GetAll().OrderBy(_ => _.ProgramName).ThenBy(_ => _.FunctionName); var oldProgramFunctionAuthority = _programFunctionAuthorityRepository.Find(_ => _.AuthorityGroupID.Equals(_id)); dgvDuLieu.Rows.Clear(); int check = 0; foreach (var programFunctionMaster in programFunctionMasters) { check = 0; foreach (var programFunctionAuthority in oldProgramFunctionAuthority) { if (programFunctionAuthority.ProgramName == programFunctionMaster.ProgramName && programFunctionAuthority.FunctionName == programFunctionMaster.FunctionName) { check = 1; break; } } object[] rowAdd = { check, programFunctionMaster.ProgramName, programFunctionMaster.FunctionName, programFunctionMaster.Explanation }; dgvDuLieu.Rows.Add(rowAdd); } }