private void initData() { if (GlobalInfo.loginUser.UserType == GlobalInfo.DEPT_MGR) { // 默认查询提交状态的请假 list = dao.FindByDeptMgr(1, GlobalInfo.loginEmp.DeptId, GlobalInfo.loginEmp.Id); empList = empDao.FindByDeptId(GlobalInfo.loginEmp.DeptId); } else if (GlobalInfo.loginUser.UserType == GlobalInfo.ADMIN) { list = dao.FindByAdmin(1); empList = empDao.FindByUserType(GlobalInfo.loginUser.UserType); } var bindingList = new BindingList <HRLeave>(list); listSource = new BindingSource(bindingList, null); grid.DataSource = null; grid.DataSource = listSource; cboEmp.DataSource = empList; cboEmp.SelectedIndex = -1; cboStatus.DataSource = DataDictionaryUtils.GetLeaveStatusDict(); cboStatus.SelectedIndex = -1; }
private void grid_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { DataRow[] rows = null; if (grid.Columns[e.ColumnIndex].Name.Equals("gridLeaveType")) { rows = DataDictionaryUtils.GetLeaveTypeDict().Select("value=" + e.Value); } if (grid.Columns[e.ColumnIndex].Name.Equals("gridStatus")) { rows = DataDictionaryUtils.GetLeaveStatusDict().Select("value=" + e.Value); } if (rows != null) { e.Value = rows[0]["label"]; } }