private void saveDetials() { string selectedCompanyName = (dialogUpdatePlacementDetails.dropdown_company.SelectedItem == null) ? string.Empty : dialogUpdatePlacementDetails.dropdown_company.SelectedItem.ToString(); if (isValidated(selectedCompanyName)) { long selectedCompanyDetailId = compMap[selectedCompanyName].compDetailsId; if (dialogUpdatePlacementDetails.isBulkUpdate) { result = DialogResult.No; var argsMap = new Dictionary <string, Object>(); argsMap.Add("compId", selectedCompanyDetailId); argsMap.Add("DOR", dialogUpdatePlacementDetails.dateTime_dor.Value); argsMap.Add("filePath", dialogUpdatePlacementDetails.filePath); startBackgroundThread(true, argsMap, null); } else { long studentId = studentObj.studentId; var placedObj = new Entity_PlacementDetails (studentId, selectedCompanyDetailId, dialogUpdatePlacementDetails.dateTime_dor.Value); startBackgroundThread(true, null, placedObj); } } }
private void startBackgroundThread(bool dialogRequired, IDictionary <string, Object> argsMap, Entity_PlacementDetails placedObj) { if (!backgroundWorker1.IsBusy) { if (dialogRequired) { myProgressDialog = new DIalog_ProgressBar(); this.Opacity = 0.8; myProgressDialog.Show(); } if (placedObj == null) { backgroundWorker1.RunWorkerAsync(argsMap); } else { backgroundWorker1.RunWorkerAsync(placedObj); } dialogUpdatePlacementDetails.pictureBox1.Enabled = false; } }