private void btnProcess_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; lblStartTime.Text = DateTime.Now.ToLongTimeString(); lblStartTime.Update(); btnProcess.Enabled = false; try { log.Debug("btnProcess_Click()"); //Get file type ImportBase pdf; switch (clbFileType.CheckedIndices[0]) { case 0: pdf = new ProcessCommunityUpdate(HealthSystemID); break; case 1: pdf = new ProcessDiagnosisFile(HealthSystemID); break; case 2: pdf = new ProcessEncounterFile(HealthSystemID); break; case 3: pdf = new ProcessProcedureFile(HealthSystemID); break; case 4: pdf = new ProcessProcedureFile(HealthSystemID); break; default: throw new ApplicationException("No file type chosen"); } int FileID = Convert.ToInt32(txtFileID.Text); pdf.UpdateProductionData = cbUpdateProduction.Checked; pdf.Execute(FileID); } finally { btnProcess.Enabled = true; this.Cursor = Cursors.Default; lblEndTime.Text = DateTime.Now.ToLongTimeString(); } }
/// <summary> /// Create a row that indicates we are processing a Community Update /// </summary> public void UpdateCommunityData() { // Add a row to the ImportedFileStatus table that indicates // that we are running a community Update Int32 ImportedFileStatusID = 0; ImportedFileStatus file = new ImportedFileStatus() { ClientOrganizationID = 1, FileName = string.Empty, ProcessedBy = Environment.UserName, ProcessFileTypeID = (int) ProcessFileType.CommunityDataFile, ProcessStatusID = (int) ProcessStatus.Processing, ProcessTypeID = (int) ProcessType.FileLoad, InsertJobID = 0, ErrorCodeID = 0 }; SystemDataProvider.ClientDataProvider.ImportedFileStatusSave(ref file); ImportedFileStatusID = file.ImportedFileStatusID; //TODO: Modify constructor to accept list of ZipCodes to process for ProcessCommunityUpdate process = new ProcessCommunityUpdate(SystemDataProvider) { UpdateProductionData = true }; try { process.Execute(ImportedFileStatusID); file.ProcessStatusID = (int)ProcessStatus.Successful; SystemDataProvider.ClientDataProvider.ImportedFileStatusSave(ref file); } catch(Exception ex) { log.Error("Error updating Community Data", ex); file.ProcessStatusID = (int)ProcessStatus.Failure; SystemDataProvider.ClientDataProvider.ImportedFileStatusSave(ref file); } }