private void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { switch (TaskId) { case MainFormEnum.BindDataBaseToUI.NothingToDo: break; case MainFormEnum.BindDataBaseToUI.BindTeacherEntityToGridview: if (dt != null) { MainFormUIBind.DataGridViewBind.GetTeacherEntityToDataGridView(dataGridView_Teacher, dt); dt = null; TaskId = MainFormEnum.BindDataBaseToUI.NothingToDo; } break; case MainFormEnum.BindDataBaseToUI.BindActiveYearEntityToComboBox: break; case MainFormEnum.BindDataBaseToUI.BindVwCscheduleEntityToGridview: if (dt != null) { dataGridView1.DataSource = dt; dt = null; TaskId = MainFormEnum.BindDataBaseToUI.NothingToDo; } break; } }
private void buttonKCBtoGridView_Click(object sender, EventArgs e) { if (comboBox_Activeyear.Items.Count > 0) { TaskId = MainFormEnum.BindDataBaseToUI.BindVwCscheduleEntityToGridview; if (!backgroundWorker.IsBusy) { backgroundWorker.RunWorkerAsync( (int)ConvertHelper.ConvertStringToInt(comboBox_Activeyear.SelectedValue.ToString())); } } }
private void buttonKCBtoGridView_Click(object sender, EventArgs e) { if (comboBox_Activeyear.Items.Count > 0) { TaskId = MainFormEnum.BindDataBaseToUI.BindVwCscheduleEntityToGridview; if (!backgroundWorker.IsBusy) { backgroundWorker.RunWorkerAsync((int)ConvertHelper.ConvertStringToInt(comboBox_Activeyear.SelectedValue.ToString())); } } }
private void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { switch (TaskId) { case MainFormEnum.BindDataBaseToUI.NothingToDo: break; case MainFormEnum.BindDataBaseToUI.BindTeacherEntityToGridview: if (dt != null) { MainFormUIBind.DataGridViewBind.GetTeacherEntityToDataGridView(dataGridView_Teacher, dt); dt = null; TaskId = MainFormEnum.BindDataBaseToUI.NothingToDo; } break; case MainFormEnum.BindDataBaseToUI.BindActiveYearEntityToComboBox: break; case MainFormEnum.BindDataBaseToUI.BindVwCscheduleEntityToGridview: if (dt!=null) { dataGridView1.DataSource = dt; dt = null; TaskId = MainFormEnum.BindDataBaseToUI.NothingToDo; } break; } }