public EmployeeSalaryReport() { InitializeComponent(); yearcomboBox.SelectedIndex = 0; monthcomboBox.SelectedIndex = 0; EmployeeDAO aEmployeeDao=new EmployeeDAO(); List<Employee> aEmployees=new List<Employee>(); aEmployees = aEmployeeDao.GetAllEmployee(); employeecomboBox.DataSource = aEmployees; employeecomboBox.DisplayMember = "EmployeeName"; employeecomboBox.ValueMember = "EmployeeId"; }
private void employeeNametextBox_TextChanged(object sender, EventArgs e) { if (employeeNametextBox.Text == "" || string.IsNullOrEmpty(employeeNametextBox.Text)) { LoadDataGridView(); } else { EmployeeDAO aEmployeeDao = new EmployeeDAO(); List<Employee> aEmployees = new List<Employee>(); aEmployees = aEmployeeDao.GetAllEmployee(); List<Employee> aaEmployees = (from myRow in aEmployees.AsEnumerable() where myRow.EmployeeName.ToUpper().StartsWith(employeeNametextBox.Text.ToUpper()) select myRow).ToList(); // DataView view = results.AsDataView(); employeedataGridView.DataSource = aaEmployees; } }
private void LoadDataGridView() { EmployeeDAO aEmployeeDao=new EmployeeDAO(); List<Employee> aEmployees=new List<Employee>(); aEmployees = aEmployeeDao.GetAllEmployee(); employeedataGridView.DataSource = aEmployees; }