/// <summary> /// Log information about the test opportunity in table TestOpportunityStatus, and /// also invoke the QC_AcceptOpportunity stored procedure, which signals TDS_Session that /// the opportunity has been succesfully reported. /// /// </summary> /// <param name="tr"></param> /// <param name="fileLocation"></param> /// <param name="environment"></param> public void SaveResultInfo(TestResult tr, Int64 fileID, bool isDemo, long?dorRecordId, long?archiveFileId, string message, bool passedValidation, bool sentToRB) { DataTable testStatusTable = new DataTable(); int opportunity = -1; int? windowOpportunity = null; string oppID = string.Empty; string testWindowID = string.Empty; if (tr.Opportunity != null) { opportunity = tr.Opportunity.OpportunityNumber; oppID = tr.Opportunity.OpportunityID; testWindowID = tr.Opportunity.WindowID; windowOpportunity = tr.Opportunity.WindowOpportunityNumber; } int result = TDSQC.InsertTestOpportunityStatus(tr.Testee.EntityKey, tr.Name, opportunity, oppID, tr.Opportunity.Status, passedValidation, tr.Opportunity.StartDate, tr.Opportunity.StatusDate, tr.Opportunity.CompletedDate, tr.Opportunity.QASystemDateRecorded, message, tr.TestID, fileID, isDemo, testWindowID, windowOpportunity, dorRecordId, tr.Mode, archiveFileId, sentToRB, ConfigurationManager.ConnectionStrings["TDSQC"].ConnectionString); if (result <= 0) { Logger.Log(true, "Unable to insert TestOpportunityStatus record for OppID: " + tr.Opportunity.OpportunityID + ", entityKey: " + tr.Testee.EntityKey, EventLogEntryType.Warning, false, true); } // Paper tests will have an empty opp key. For these, we don't want to // call back to TDS. Just return. //commented this section as this is handled in Finally block of QA system.cs /*if (tr.Opportunity.Key == Guid.Empty) * return; * * using (DbCommand cmd = _db_session.GetStoredProcCommand("QC_ACCEPTOPPORTUNITY")) * { * _db_session.AddInParameter(cmd, "@opportunityKey", DbType.Guid, tr.Opportunity.Key); * _db_session.AddInParameter(cmd, "@allRulesPassed", DbType.Boolean, tr.PassedAllValidations()); * _db_session.AddInParameter(cmd, "@fileLocation", DbType.String, fileID); * try * { * int count = _db_session.ExecuteNonQuery(cmd); * if (count == 0) * { * throw new Exception("No records saved in archive database."); * } * } * catch (Exception ex) * { * throw ex; * } * }*/ }