public void CheckAllDepartmentInfo_Load(object sender, EventArgs e) { try { eajd.AutoUpdateDepartmentTotalEmployee(); pd.AutoUpdateDepartmentTotalSalary(); List<Department> dataReceived = new DepartmentData().GetDepartmentList(); dataGridView1.DataSource = dataReceived; } catch(Exception ex) { MessageBox.Show(ex.Message); } }
private void WorkerDepartment_DoWork(object sender, DoWorkEventArgs e) { // Executes when RunWorkerAsync() is called List<Department> dataReceived = new DepartmentData().GetDepartmentList(); //change for other all e.Result = dataReceived; }