public void CloseSession(InspectionsSyncSession session) { session.Sync(() => { try { m_database.Sql().Call("inspfw_closeSession") .WithParam("@projectId", m_session.Project.Id) .WithParam("@sessionId", session.SessionId) .NonQuery(); } catch (Exception e) { m_log.Error($"Cannot close inspection session", e); } }); }
public void RunInspection(InspectionsSyncSession session, string procedureName) { session.Sync(() => { try { // @spName VARCHAR(300), @projectId INT, @sessionId INT, @retryIssueId INT = null m_database.Sql().Call("inspfw_runInspection") .WithParam("@sessionId", session.SessionId) .WithParam("@projectId", m_session.Project.Id) .WithParam("@spName", procedureName) .NonQuery(); } catch (Exception ex) { m_log.Error($"Inspection failed sp={procedureName}, sessionId={session.SessionId}", ex); } }); }
public void RunInspectionAndCloseSession(InspectionsSyncSession session, int issueId) { session.Sync(() => { using (var tx = m_database.OpenTransaction()) { try { m_database.Sql().Call("inspfw_runInspection") .WithParam("@sessionId", session.SessionId) .WithParam("@projectId", m_session.Project.Id) .WithParam("@retryIssueId", issueId) .NonQuery(); } catch (Exception ex) { m_log.Error($"Inspection failed sessionId={session.SessionId}, issueId={issueId}", ex); try { CloseSession(session); } catch (Exception e) { m_log.Error($"Cannot close session sessionId={session.SessionId}, issueId={issueId}", e); } throw; } m_database.Sql().Call("inspfw_closeSession") .WithParam("@projectId", m_session.Project.Id) .WithParam("@sessionId", session.SessionId) .WithParam("@forIssueId", issueId) .NonQuery(); tx.Commit(); } }); }