protected void getTestCaseInfo() { SqlCommand cmd = connect.CreateCommand(); cmd.CommandText = "select testCase_createdBy from TestCases where testCaseId = '" + g_testCaseId + "' "; string createdByUserId = cmd.ExecuteScalar().ToString(); cmd.CommandText = "select testCase_createdDate from TestCases where testCaseId = '" + g_testCaseId + "' "; string createddate = cmd.ExecuteScalar().ToString(); cmd.CommandText = "select testCase_uniqueId from TestCases where testCaseId = '" + g_testCaseId + "' "; string testCaseUID = cmd.ExecuteScalar().ToString(); cmd.CommandText = "select testCase_testCaseScenario from TestCases where testCaseId = '" + g_testCaseId + "' "; string testCaseScenario = cmd.ExecuteScalar().ToString(); cmd.CommandText = "select testCase_expectedOutput from TestCases where testCaseId = '" + g_testCaseId + "' "; string expectedOutput = cmd.ExecuteScalar().ToString(); cmd.CommandText = "select testCase_isDeleted from TestCases where testCaseId = '" + g_testCaseId + "' "; int isDeleted = Convert.ToInt32(cmd.ExecuteScalar()); cmd.CommandText = "select testCase_hasImage from TestCases where testCaseId = '" + g_testCaseId + "' "; int hasImage = Convert.ToInt32(cmd.ExecuteScalar()); cmd.CommandText = "select testCase_currentStatus from TestCases where testCaseId = '" + g_testCaseId + "' "; string currentStatus = cmd.ExecuteScalar().ToString(); cmd.CommandText = "select count(testCase_editedBy) from TestCases where testCaseId = '" + g_testCaseId + "' "; int countEditedBy = Convert.ToInt32(cmd.ExecuteScalar()); cmd.CommandText = "select count(testCase_editedDate) from TestCases where testCaseId = '" + g_testCaseId + "' "; int countEditedDate = Convert.ToInt32(cmd.ExecuteScalar()); cmd.CommandText = "select count(testCase_previousVersion) from TestCases where testCaseId = '" + g_testCaseId + "' "; int countPreviousVersion = Convert.ToInt32(cmd.ExecuteScalar()); string testCase_editedBy = "", testCase_editedDate = "", testCase_previousVersion = ""; if (countEditedBy > 0) { cmd.CommandText = "select testCase_editedBy from TestCases where testCaseId = '" + g_testCaseId + "' "; testCase_editedBy = cmd.ExecuteScalar().ToString(); } if (countEditedDate > 0) { cmd.CommandText = "select testCase_editedDate from TestCases where testCaseId = '" + g_testCaseId + "' "; testCase_editedDate = cmd.ExecuteScalar().ToString(); } if (countPreviousVersion > 0) { cmd.CommandText = "select testCase_previousVersion from TestCases where testCaseId = '" + g_testCaseId + "' "; testCase_previousVersion = cmd.ExecuteScalar().ToString(); } //Loop through the developers for the selected Test Case: cmd.CommandText = "select count(*) from Parameters where testcaseId = '" + g_testCaseId + "' "; int parametersForTestCase = Convert.ToInt32(cmd.ExecuteScalar()); string inputParameters = ""; for (int j = 1; j <= parametersForTestCase; j++) { cmd.CommandText = "select parameter_name from(SELECT rowNum = ROW_NUMBER() OVER(ORDER BY parameterId ASC), * FROM Parameters where testCaseId = '" + g_testCaseId + "' ) as t where rowNum = '" + j + "'"; string parameter_name = cmd.ExecuteScalar().ToString(); if (j == 1) { inputParameters = parameter_name; } else { inputParameters = inputParameters + ",\n" + parameter_name; } } //Convert the createdByUserId to a name: cmd.CommandText = "select (user_firstname + ' ' + user_lastname) from Users where userId = '" + createdByUserId + "' "; string createdByName = cmd.ExecuteScalar().ToString(); cmd.CommandText = "select userId from Users where loginId = '" + loginId + "' "; string userId = cmd.ExecuteScalar().ToString(); string imagesHTML = ""; if (hasImage == 1) { cmd.CommandText = "select count(*) from ImagesForTestCases where testCaseId = '" + g_testCaseId + "' "; int totalImages = Convert.ToInt32(cmd.ExecuteScalar()); for (int i = 1; i <= totalImages; i++) { cmd.CommandText = "select [imageId] from(SELECT rowNum = ROW_NUMBER() OVER(ORDER BY imageId ASC), * FROM [ImagesForTestCases] where testCaseId = '" + g_testCaseId + "') as t where rowNum = '" + i + "'"; string imageId = cmd.ExecuteScalar().ToString(); cmd.CommandText = "select image_name from Images where imageId = '" + imageId + "' "; string image_name = cmd.ExecuteScalar().ToString(); imagesHTML = imagesHTML + "<a href='../../images/" + image_name + "' target=\"_blank\">" + image_name + "</a> <br />"; } } cmd.CommandText = "select userStory_uniqueId from UserStories where userStoryId = '" + g_userStoryId + "' "; string userStoryUId = cmd.ExecuteScalar().ToString(); cmd.CommandText = "select sprintTask_uniqueId from SprintTasks where sprintTaskId = '" + g_sprintTaskId + "' "; string sprintTaskUId = cmd.ExecuteScalar().ToString(); //Construct an HTML output to post it: lblTestCaseInfo.Text = Layouts.testCaseHeader(g_testCaseId, g_sprintTaskId, roleId, loginId, userId, createdByUserId, createddate, createdByName, testCaseUID, testCaseScenario, expectedOutput, inputParameters, isDeleted, imagesHTML, hasImage, currentStatus, userStoryUId, sprintTaskUId, testCase_editedBy, testCase_editedDate, testCase_previousVersion); }