public JsonResult GetStakeholderProjectDetails() { try { string AppUrl = HttpContext.Request.Headers["appurl"]; string SchemaName = ""; string _SpUserId = HttpContext.Request.Headers["LoggedInUserSPUserId"]; if (!string.IsNullOrEmpty(AppUrl)) { SchemaName = new clsUatClient(_context).GetClientSchema(AppUrl); } else { return(Json("Invalid Url")); } using (var cmd = _context.Database.GetDbConnection().CreateCommand()) { cmd.CommandText = "UAT.spStakeholderDashboardReportProjectDetails"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@SPUserId", SqlDbType.Int) { Value = _SpUserId }); cmd.Parameters.Add(new SqlParameter("@SchemaName", SqlDbType.VarChar, 500) { Value = SchemaName }); cmd.Parameters.Add(new SqlParameter("@Ret_Parameter", SqlDbType.VarChar, 500) { Direction = ParameterDirection.Output }); if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } var retObject = new List <dynamic>(); using (var dataReader = cmd.ExecuteReader()) { while (dataReader.Read()) { var dataRow = new ExpandoObject() as IDictionary <string, object>; for (var iFiled = 0; iFiled < dataReader.FieldCount; iFiled++) { dataRow.Add(dataReader.GetName(iFiled), dataReader.IsDBNull(iFiled) ? null : dataReader[iFiled]); } retObject.Add((ExpandoObject)dataRow); } } return(Json(retObject)); } } catch (Exception ex) { return(Json(ex.Message)); } }
public JsonResult GetDescAttachment(string attachID) { //[spGetAttachmentDesc] try { string SchemaName = ""; string AppUrl = HttpContext.Request.Headers["appurl"]; if (!string.IsNullOrEmpty(AppUrl)) { SchemaName = new clsUatClient(_context).GetClientSchema(AppUrl); } var desc = ""; using (var cmd = _context.Database.GetDbConnection().CreateCommand()) { cmd.CommandText = "UAT.spGetAttachmentDesc"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@SchemaName", SqlDbType.NVarChar, 500) { Value = SchemaName }); cmd.Parameters.Add(new SqlParameter("@AttachmentId", SqlDbType.Int, 15) { Value = attachID }); SqlParameter outparam = new SqlParameter(this._returnParameter, SqlDbType.NVarChar, 500) { Direction = ParameterDirection.Output }; cmd.Parameters.Add(outparam); if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } using (var dataReader = cmd.ExecuteReader()) { while (dataReader.Read()) { desc = dataReader["Description"] == null? null: dataReader["Description"].ToString(); } return(Json(desc)); } } } catch (Exception ex) { return(null); } }
public FileResult GetUploadFilesfromDB() { string AppUrl = HttpContext.Request.Headers["appurl"]; string SchemaName = ""; string _SpUserId = HttpContext.Request.Headers["LoggedInUserSPUserId"]; if (!string.IsNullOrEmpty(AppUrl)) { SchemaName = new clsUatClient(_context).GetClientSchema(AppUrl); } else { } var filename = ""; var contentType = ""; using (var cmd = _context.Database.GetDbConnection().CreateCommand()) { cmd.CommandText = "GetfilefromDB"; cmd.CommandType = CommandType.StoredProcedure; if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } using (var dataReader = cmd.ExecuteReader()) { while (dataReader.Read()) { filename = dataReader["imagename"].ToString(); contentType = dataReader["ContentType"].ToString(); byte[] bytes = (byte[])dataReader["imagedata"]; Response.ContentType = dataReader["ContentType"].ToString(); Response.Headers.Add("content-disposition", "attachment;filename=" + dataReader["imagename"].ToString()); Response.Body.WriteAsync(bytes, 0, bytes.Length); } } } return(File(filename, contentType, filename)); }
public Dictionary <string, string> TestCaseSequencing(string testCaseIdSequence) { Dictionary <string, string> _result = new Dictionary <string, string>(); try { if (string.IsNullOrEmpty(testCaseIdSequence)) { Dictionary <string, string> oError = new Dictionary <string, string>(); oError.Add("ERROR", "testCaseIdSequence is required!"); return(_result); } string AppUrl = HttpContext.Request.Headers["appurl"]; string SchemaName = ""; if (!string.IsNullOrEmpty(AppUrl)) { SchemaName = new clsUatClient(_context).GetClientSchema(AppUrl); } else { _result.Add(this._errorText, "Invalid Appurl"); return(_result); } string statementType = string.Empty; using (var cmd = _context.Database.GetDbConnection().CreateCommand()) { cmd.CommandText = "[UAT].[spTestCaseSeq]"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@SequencingString", SqlDbType.Int) { Value = testCaseIdSequence }); cmd.Parameters.Add(new SqlParameter("@StatementType", SqlDbType.VarChar, 500) { Value = "Sequence" }); SqlParameter outparam = new SqlParameter("@Ret_Parameter", SqlDbType.NVarChar, 500) { Direction = ParameterDirection.Output }; cmd.Parameters.Add(new SqlParameter("@SchemaName", SqlDbType.NVarChar, 500) { Value = SchemaName }); cmd.Parameters.Add(outparam); if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } int retValPos = cmd.ExecuteNonQuery(); if (retValPos != 0) { string ReturnParamValue = Convert.ToString(cmd.Parameters["@Ret_Parameter"].Value); if (!string.IsNullOrEmpty(ReturnParamValue) && ReturnParamValue.ToLower() == "success") { _result.Add(this._statusText, "Done"); } else { List <System.Data.Common.DbParameter> _outParameter = new List <System.Data.Common.DbParameter>(); _outParameter.Add(cmd.Parameters["@Ret_Parameter"]); _result.Add(this._errorText, _outParameter.ToString()); } } else { List <System.Data.Common.DbParameter> _outParameter = new List <System.Data.Common.DbParameter>(); foreach (System.Data.Common.DbParameter outP in _outParameter) { if (outP.Direction == ParameterDirection.Output) { _outParameter.Add(outP); } } } } } catch (Exception ex) { _result.Add(this._errorText, ex.Message); } return(_result); }
public List <TesterRoleNames> CopyTestCase([FromBody] TestCaseCopy otestcasecopy) { List <TesterRoleNames> TesterRoleNames = new List <TesterRoleNames>(); Dictionary <string, string> _result = new Dictionary <string, string>(); try { string AppUrl = HttpContext.Request.Headers["appurl"]; string SchemaName = ""; if (!string.IsNullOrEmpty(AppUrl)) { SchemaName = new clsUatClient(_context).GetClientSchema(AppUrl); } else { return(null); } if (string.IsNullOrEmpty(otestcasecopy.testPassId) || string.IsNullOrEmpty(otestcasecopy.testCaseId) || string.IsNullOrEmpty(otestcasecopy.destTestPassId)) { TesterRoleNames.Add(new TesterRoleNames() { errorText = this._errorText, errorValue = "Test pass Id, test case Id,testPassIdDestination is required!", }); return(TesterRoleNames); } using (var cmd = _context.Database.GetDbConnection().CreateCommand()) { cmd.CommandText = "[uat].[sptestcasecopy]"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@oldtestpassid", SqlDbType.Int) { Value = otestcasecopy.testPassId }); cmd.Parameters.Add(new SqlParameter("@oldtestcaseid", SqlDbType.Int) { Value = otestcasecopy.testCaseId }); cmd.Parameters.Add(new SqlParameter("@newtestpassid", SqlDbType.Int) { Value = otestcasecopy.destTestPassId }); SqlParameter outparam = new SqlParameter("@Ret_Parameter", SqlDbType.VarChar, 500) { Direction = ParameterDirection.Output }; cmd.Parameters.Add(new SqlParameter("@SchemaName", SqlDbType.NVarChar, 500) { Value = SchemaName }); cmd.Parameters.Add(outparam); if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } #region 'Old Code' //int retValPos = cmd.ExecuteNonQuery(); //if (retValPos != 0) //{ // string ReturnParamValue = Convert.ToString(cmd.Parameters["@Ret_Parameter"].Value); // using (var dr = cmd.ExecuteReader()) // { // int user_name = dr.GetOrdinal("user_name"); // int role_name = dr.GetOrdinal("role_name"); // while (dr.Read()) // { // user_name = Convert.ToInt32(dr["user_name"]); // role_name = Convert.ToInt32(dr["role_name"]); // TesterRoleNames.Add(new TesterRoleNames() // { // errorText = "added", // errorValue = "yes", // testerName = (dr.IsDBNull(user_name)) == true ? "" : Convert.ToString(dr["user_name"]), // roleName = (dr.IsDBNull(role_name)) == true ? "" : Convert.ToString(dr["role_name"]), // }); // } // } // if (!string.IsNullOrEmpty(ReturnParamValue) && ReturnParamValue.ToLower() == "success") // { // TesterRoleNames.Add(new TesterRoleNames() // { // errorText = this._statusText, // errorValue = "Done", // }); // } // else if (ReturnParamValue.ToLower() == "test case name already exists") // { // TesterRoleNames.Add(new TesterRoleNames() // { // errorText = this._statusText, // errorValue = ReturnParamValue, // }); // } // else // { // List<System.Data.Common.DbParameter> _outParameter = new List<System.Data.Common.DbParameter>(); // _outParameter.Add(cmd.Parameters["@Ret_Parameter"]); // TesterRoleNames.Add(new TesterRoleNames() // { // errorText = this._errorText, // errorValue = _outParameter.ToString(), // }); // } //} #endregion using (var dr = cmd.ExecuteReader()) { if (dr.HasRows) { while (dr.Read()) { TesterRoleNames.Add(new TesterRoleNames() { errorText = "added", errorValue = "yes", testerName = dr["user_name"] == null ? "" : Convert.ToString(dr["user_name"]), roleName = dr["role_name"] == null ? "" : Convert.ToString(dr["role_name"]), }); } } } int retValPos = 1; // cmd.ExecuteNonQuery(); if (retValPos > 0) { string ReturnParamValue = Convert.ToString(cmd.Parameters["@Ret_Parameter"].Value); if (!string.IsNullOrEmpty(ReturnParamValue) && ReturnParamValue.ToLower() == "success") { TesterRoleNames.Add(new TesterRoleNames() { errorText = this._statusText, errorValue = "Done", }); } else if (ReturnParamValue.ToLower() == "test case name already exists") { TesterRoleNames.Add(new TesterRoleNames() { errorText = this._statusText, errorValue = ReturnParamValue, }); } else { List <System.Data.Common.DbParameter> _outParameter = new List <System.Data.Common.DbParameter>(); _outParameter.Add(cmd.Parameters["@Ret_Parameter"]); TesterRoleNames.Add(new TesterRoleNames() { errorText = this._errorText, errorValue = _outParameter.ToString(), }); } } } } catch (Exception ex) { _result.Add(this._errorText, ex.Message); } return(TesterRoleNames); }
public JsonResult InsertUpdateTestStep([FromBody] TestStep_IU testStep) { string AppUrl = HttpContext.Request.Headers["appurl"]; string SchemaName = ""; if (!string.IsNullOrEmpty(AppUrl)) { SchemaName = new clsUatClient(_context).GetClientSchema(AppUrl); } else { return(Json("Invalid Url")); } string _clientSchemaName = SchemaName; if (string.IsNullOrEmpty(_clientSchemaName)) { return(null); } Dictionary <string, string> _result = new Dictionary <string, string>(); List <System.Data.Common.DbParameter> parameter = new List <System.Data.Common.DbParameter>(); if (string.IsNullOrEmpty(testStep.testCaseId)) { _result.Add(this._errorText, " Test Case ID is required"); return(Json(_result)); } try { int _res = 0; string _roles = ""; for (int i = 0; i < testStep.roleArray.Count; i++) { _roles += testStep.roleArray[i] + ","; } if (_roles != "") { _roles = _roles.Remove(_roles.LastIndexOf(",")); } int _seq = 0; int.TryParse(testStep.testStepSequence, out _seq); //List<TestStep> dt = generateTestStepTable(testStep); using (var cmd = _context.Database.GetDbConnection().CreateCommand()) { cmd.CommandText = "UAT.spTestStep_Core"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@TestStepActionName", SqlDbType.VarChar) { Value = testStep.testStepName }); cmd.Parameters.Add(new SqlParameter("@TestCaseId", SqlDbType.Int) { Value = Convert.ToInt32(testStep.testCaseId) }); cmd.Parameters.Add(new SqlParameter("@ExpectedResult", SqlDbType.VarChar) { Value = testStep.expectedResult }); cmd.Parameters.Add(new SqlParameter("@TestStepSequence", SqlDbType.Int) { Value = Convert.ToInt32(_seq) }); cmd.Parameters.Add(new SqlParameter("@RoleArray", SqlDbType.VarChar) { Value = _roles }); cmd.Parameters.Add(new SqlParameter("@ER_Attachment_URL", SqlDbType.VarChar) { Value = testStep.erAttachmentURL }); cmd.Parameters.Add(new SqlParameter("@ER_Attachment_Name", SqlDbType.VarChar) { Value = testStep.erAttachmentName }); cmd.Parameters.Add(new SqlParameter("@Expected_Result_Image", SqlDbType.VarChar) { Value = testStep.expResultImage }); if (testStep.action.ToLower() == "edit") { cmd.Parameters.Add(new SqlParameter("@TestStepId", SqlDbType.Int) { Value = Convert.ToInt32(testStep.testStepId) }); } cmd.Parameters.Add(new SqlParameter(this._statementTypeParameterName, SqlDbType.VarChar) { Value = (testStep.action.ToLower() == "add") ? "Insert" : "Update" }); cmd.Parameters.Add(new SqlParameter(this._schemaNameParameterName, SqlDbType.NVarChar, 10) { Value = _clientSchemaName }); cmd.Parameters.Add(new SqlParameter("@UserCId", SqlDbType.Int) { Value = Convert.ToInt32(testStep.UserCid) }); SqlParameter outparam = new SqlParameter(this._returnParameter, SqlDbType.NVarChar, 500) { Direction = ParameterDirection.Output }; cmd.Parameters.Add(outparam); if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } //var resp = _context.Database.ExecuteN(); //return Json(ReturnVal.Value); _res = cmd.ExecuteNonQuery(); var OutResult = outparam.Value; if (_res > 0) { _result.Add(this._statusText, "Done"); } else { _result.Add(this._errorText, OutResult.ToString()); } } } catch (Exception ex) { _result.Add(this._errorText, ex.Message); } return(Json(_result)); }
public JsonResult InsertUpdateTestPass_1([FromBody] TestPass testpass) { if (string.IsNullOrEmpty(testpass.testPassName) || string.IsNullOrEmpty(testpass.tpStartDate) || string.IsNullOrEmpty(testpass.tpEndDate)) { Dictionary <string, string> oError = new Dictionary <string, string>(); oError.Add("ERROR", "Mandatory fields are required"); return(Json(oError)); } else if (testpass.listTestMgr.Count > 0) { if (string.IsNullOrEmpty(testpass.listTestMgr[0].alias) || string.IsNullOrEmpty(testpass.listTestMgr[0].email) || string.IsNullOrEmpty(testpass.listTestMgr[0].userName) || string.IsNullOrEmpty(testpass.listTestMgr[0].spUserId)) { Dictionary <string, string> oError = new Dictionary <string, string>(); oError.Add("ERROR", "TestManager complete details required"); return(Json(oError)); } } else if (testpass.listTestMgr.Count == 0) { Dictionary <string, string> oError = new Dictionary <string, string>(); oError.Add("ERROR", "TestManager detail required"); return(Json(oError)); } try { string AppUrl = HttpContext.Request.Headers["appurl"]; string SchemaName = ""; if (!string.IsNullOrEmpty(AppUrl)) { SchemaName = new clsUatClient(_context).GetClientSchema(AppUrl); } else { return(Json("Invalid Url")); } string statementType = string.Empty; if (string.IsNullOrEmpty(testpass.testPassId)) { statementType = "Insert"; } else { statementType = "Update"; } string SuccessMsg = ""; // string SchemaName = new clsUatClient(_context).GetClientSchema(Appurl); using (var cmd = _context.Database.GetDbConnection().CreateCommand()) { cmd.CommandText = "UAT.SpTestPass"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@TestPassId", SqlDbType.Int) { Value = testpass.testPassId }); cmd.Parameters.Add(new SqlParameter("@ProjectId", SqlDbType.Int, 500) { Value = testpass.projectId }); cmd.Parameters.Add(new SqlParameter("@TestMgrId", SqlDbType.Int, 500) { Value = testpass.listTestMgr[0].spUserId }); cmd.Parameters.Add(new SqlParameter("@TestMgrName", SqlDbType.VarChar, 500) { Value = testpass.listTestMgr[0].userName }); cmd.Parameters.Add(new SqlParameter("@TestMgrAlias", SqlDbType.VarChar, 500) { Value = testpass.listTestMgr[0].alias }); cmd.Parameters.Add(new SqlParameter("@TestMgrEmailId", SqlDbType.VarChar, 500) { Value = testpass.listTestMgr[0].email }); cmd.Parameters.Add(new SqlParameter("@TestMgrSecurityId", SqlDbType.Int, 500) { Value = testpass.listTestMgr[0].securityId }); cmd.Parameters.Add(new SqlParameter("@TestPassName", SqlDbType.NVarChar, 500) { Value = testpass.testPassName }); cmd.Parameters.Add(new SqlParameter("@DisplayID", SqlDbType.NVarChar, 500) { Value = testpass.testPassDisplayId }); cmd.Parameters.Add(new SqlParameter("@Description", SqlDbType.NVarChar, 500) { Value = testpass.testPassDesp }); cmd.Parameters.Add(new SqlParameter("@StartDate", SqlDbType.Date, 500) { Value = testpass.tpStartDate }); cmd.Parameters.Add(new SqlParameter("@EndDate", SqlDbType.Date, 500) { Value = testpass.tpEndDate }); cmd.Parameters.Add(new SqlParameter("@Status", SqlDbType.VarChar, 500) { Value = testpass.tpStatus }); if (!string.IsNullOrEmpty(testpass.tpStatus)) { cmd.Parameters[cmd.Parameters.Count - 1].Value = GetShortStatus(testpass.tpStatus); } else { cmd.Parameters[cmd.Parameters.Count - 1].Value = DBNull.Value; } cmd.Parameters.Add(new SqlParameter("@StatementType", SqlDbType.VarChar, 500) { Value = statementType }); SqlParameter outparam = new SqlParameter("@Ret_Parameter", SqlDbType.NVarChar, 500) { Direction = ParameterDirection.Output }; cmd.Parameters.Add(new SqlParameter("@SchemaName", SqlDbType.NVarChar, 500) { Value = SchemaName }); cmd.Parameters.Add(outparam); if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } int i = cmd.ExecuteNonQuery(); var outparam1 = outparam.Value; if (i == -1) { if (Convert.ToString(outparam1) != "" && outparam1 != null) { //SuccessMsg = "Insert Successfully..!!"; SuccessMsg = "Done"; } } return(Json(SuccessMsg)); } } catch (Exception ex) { return(Json(ex.Message)); } }
public IActionResult UploadFile() { //string AppUrl = HttpContext.Request.Headers["appurl"]; string AppUrl = HttpContext.Request.Headers["appurl"]; string SchemaName = ""; string _SpUserId = HttpContext.Request.Headers["LoggedInUserSPUserId"]; bool isUpload = false; if (!string.IsNullOrEmpty(AppUrl)) { SchemaName = new clsUatClient(_context).GetClientSchema(AppUrl); } else { isUpload = false; } /*test Code 1*/ byte[] byt; byte[] fileRecord; using (var reader = new StreamReader(HttpContext.Request.Form.Files["file"].OpenReadStream())) { var fileContent = reader.ReadToEnd(); ////BinaryReader br = new BinaryReader(HttpContext.Request.Form.Files["file"].OpenReadStream()); ////byt = br.ReadBytes((Int32)fileContent.Length); Stream file_strm = Request.Form.Files["file"].OpenReadStream(); int fileSize = Convert.ToInt32(Request.Form.Files["file"].Length); fileRecord = new byte[fileSize]; file_strm.Read(fileRecord, 0, fileSize); } /*end*/ int new_AttachmentId = Convert.ToInt32(HttpContext.Request.Form["attaid"]); string new_AttachmentName = HttpContext.Request.Form["fileName"]; //var stream = HttpContext.Request.Form.Files["file"]; ///*Test Code*/ //var uploads = Path.Combine(_env.WebRootPath, "upload"); //using (var fileStream = new FileStream(Path.Combine(uploads, stream.FileName), FileMode.Create)) //{ // stream.CopyTo(fileStream); //} ///*END*/ //var name = stream.FileName; //int Length = Convert.ToInt32(HttpContext.Request.ContentLength); //byte[] bytes = new byte[Length]; //stream.OpenReadStream().Read(bytes, 0, Length); using (var cmd = _context.Database.GetDbConnection().CreateCommand()) { cmd.CommandText = "UAT.spUploadFile"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@FileName", SqlDbType.VarChar, 500) { Value = new_AttachmentName }); cmd.Parameters.Add(new SqlParameter("@ContentType", SqlDbType.VarChar, 500) { Value = HttpContext.Request.Form.Files["file"].ContentType }); cmd.Parameters.Add(new SqlParameter("@SchemaName", SqlDbType.VarChar, 500) { Value = SchemaName }); cmd.Parameters.Add(new SqlParameter("@AttachmentID", SqlDbType.Int) { Value = new_AttachmentId }); cmd.Parameters.Add(new SqlParameter("@FileData", SqlDbType.VarBinary, 5000000) { Value = fileRecord }); //byt cmd.Parameters.Add(new SqlParameter("@outval", SqlDbType.Bit) { Direction = ParameterDirection.Output }); if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } int i = cmd.ExecuteNonQuery(); bool outval = (bool)cmd.Parameters["@outval"].Value; if (i != 0 && outval != false) { isUpload = true; } } return(Json(isUpload)); }
public JsonResult GetTestCaseDetailForTestPassIdWithTesterFlag(string testPassId) { List <TestCase_New> listTestCaseDetails = new List <TestCase_New>(); int _res = 0; string status = string.Empty; string statementType = string.Empty; /**************************************************************************************************/ /**************************************************************************************************/ string AppUrl = HttpContext.Request.Headers["appurl"]; string SchemaName = ""; if (!string.IsNullOrEmpty(AppUrl)) { SchemaName = new clsUatClient(_context).GetClientSchema(AppUrl); } else { return(Json("Invalid Url")); } string _clientSchemaName = SchemaName; if (string.IsNullOrEmpty(_clientSchemaName)) { return(null); } Dictionary <string, string> oError = new Dictionary <string, string>(); if (string.IsNullOrEmpty(testPassId)) { oError.Add("ERROR", "Test Pass ID is required"); return(Json(oError)); } using (var cmd = _context.Database.GetDbConnection().CreateCommand()) { cmd.CommandText = "UAT.SpTestCase"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@TestPassId", SqlDbType.VarChar) { Value = testPassId }); cmd.Parameters.Add(new SqlParameter(this._schemaNameParameterName, SqlDbType.NVarChar, 10) { Value = _clientSchemaName }); cmd.Parameters.Add(new SqlParameter("@StatementType", SqlDbType.NVarChar, 10) { Value = "Select" }); SqlParameter outparam = new SqlParameter(this._returnParameter, SqlDbType.NVarChar, 500) { Direction = ParameterDirection.Output }; cmd.Parameters.Add(outparam); if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } _res = cmd.ExecuteNonQuery(); var retObject = new List <dynamic>(); var OutResult = outparam.Value; string flagTester = ""; string retValue = ""; retValue = OutResult.ToString(); if (retValue == "SUCCESS") { flagTester = "y"; } else if (retValue == "No Tester(s) Assigned!") { flagTester = "n"; } using (var dataReader = cmd.ExecuteReader()) { int TestCase_IdOrdinal = dataReader.GetOrdinal("TestCase_Id"); int TestPass_IdOrdinal = dataReader.GetOrdinal("TestPass_Id"); int DisplayTestCase_IdOrdinal = dataReader.GetOrdinal("DisplayTestCase_Id"); int TestCase_NameOrdinal = dataReader.GetOrdinal("TestCase_Name"); int TestCase_DescriptionOrdinal = dataReader.GetOrdinal("TestCase_Description"); int Testcase_SequenceOrdinal = dataReader.GetOrdinal("Testcase_Sequence"); int ETTOrdinal = dataReader.GetOrdinal("ETT"); if (dataReader.HasRows != false) { while (dataReader.Read()) { listTestCaseDetails.Add(new TestCase_New { TestCase_Id = (dataReader.IsDBNull(TestCase_IdOrdinal)) == true ? "" : Convert.ToString(dataReader[TestCase_IdOrdinal]), TestPass_Id = (dataReader.IsDBNull(TestPass_IdOrdinal)) == true ? "" : Convert.ToString(dataReader[TestPass_IdOrdinal]), DisplayTestCase_Id = (dataReader.IsDBNull(DisplayTestCase_IdOrdinal)) == true ? "" : Convert.ToString(dataReader[DisplayTestCase_IdOrdinal]), TestCase_Name = (dataReader.IsDBNull(TestCase_NameOrdinal)) == true ? "" : Convert.ToString(dataReader[TestCase_NameOrdinal]), TestCase_Description = (dataReader.IsDBNull(TestCase_DescriptionOrdinal)) == true ? "" : Convert.ToString(dataReader[TestCase_DescriptionOrdinal]), Testcase_Sequence = (dataReader.IsDBNull(Testcase_SequenceOrdinal)) == true ? "" : Convert.ToString(dataReader[Testcase_SequenceOrdinal]), testcaseETT = (dataReader.IsDBNull(ETTOrdinal)) == true ? "" : Convert.ToString(dataReader[ETTOrdinal]), testcaseflagTester = flagTester }); } } else { listTestCaseDetails.Add(new TestCase_New { TestCase_Id = "", TestPass_Id = "", DisplayTestCase_Id = "", TestCase_Name = "", TestCase_Description = "", Testcase_Sequence = "", testcaseETT = "", testcaseflagTester = flagTester }); } } return(Json(listTestCaseDetails)); } }
public Dictionary <string, string> UserLogin(string Email, string Password) { Dictionary <string, string> _result = new Dictionary <string, string>(); try { if (string.IsNullOrEmpty(Email) || string.IsNullOrEmpty(Password)) { //send service level Exception as service response _result.Add(this._errorText, "Mandatory Fields data is required"); return(_result); } string AppUrl = HttpContext.Request.Headers["appurl"]; string SchemaName = ""; if (!string.IsNullOrEmpty(AppUrl)) { SchemaName = new clsUatClient(_context).GetClientSchema(AppUrl); } else { _result.Add(this._errorText, "Invalid Appurl"); return(_result); } using (var cmd = _context.Database.GetDbConnection().CreateCommand()) { cmd.CommandText = "[UAT].[SpUserRegistration]"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@FirstName", SqlDbType.VarChar, 500) { Value = "" }); cmd.Parameters.Add(new SqlParameter("@LastName", SqlDbType.VarChar, 500) { Value = "" }); cmd.Parameters.Add(new SqlParameter("@Email", SqlDbType.VarChar, 500) { Value = Email }); cmd.Parameters.Add(new SqlParameter("@Password", SqlDbType.VarChar, 500) { Value = Password }); cmd.Parameters.Add(new SqlParameter("@StatementType", SqlDbType.NVarChar, 500) { Value = "Select" }); SqlParameter outparam = new SqlParameter("@Ret_Parameter", SqlDbType.NVarChar, 500) { Direction = ParameterDirection.Output }; cmd.Parameters.Add(new SqlParameter("@SchemaName", SqlDbType.NVarChar, 500) { Value = SchemaName }); cmd.Parameters.Add(outparam); if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } using (var dr = cmd.ExecuteReader()) { if (!dr.HasRows) { _result.Add(_errorText, "Invalid Id or Passoword..!!"); } while (dr.Read()) { _result.Add("ID", Convert.ToString(dr["UserId"])); } } } } catch (Exception ex) { _result.Add(this._errorText, ex.Message); } return(_result); }
public JsonResult GetTestStepsByTestPassID(string testPassId) { string AppUrl = HttpContext.Request.Headers["appurl"]; string SchemaName = ""; if (!string.IsNullOrEmpty(AppUrl)) { SchemaName = new clsUatClient(_context).GetClientSchema(AppUrl); } else { return(Json("Invalid Url")); } string _clientSchemaName = SchemaName; if (string.IsNullOrEmpty(_clientSchemaName)) { return(null); } if (string.IsNullOrEmpty(testPassId)) { Dictionary <string, string> oError = new Dictionary <string, string>(); oError.Add("ERROR", "Test Pass ID is required"); return(Json(oError)); } using (var cmd = _context.Database.GetDbConnection().CreateCommand()) { cmd.CommandText = "UAT.spGetTestStepsByTestPassIds"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@TestPassId", SqlDbType.VarChar) { Value = testPassId }); cmd.Parameters.Add(new SqlParameter(this._schemaNameParameterName, SqlDbType.NVarChar, 10) { Value = _clientSchemaName }); cmd.Parameters.Add(new SqlParameter(this._returnParameter, SqlDbType.VarChar, 500) { Direction = ParameterDirection.Output }); if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } var retObject = new List <dynamic>(); using (var dataReader = cmd.ExecuteReader()) { while (dataReader.Read()) { var dataRow = new ExpandoObject() as IDictionary <string, object>; for (var iFiled = 0; iFiled < dataReader.FieldCount; iFiled++) { dataRow.Add(dataReader.GetName(iFiled), dataReader.IsDBNull(iFiled) ? null : dataReader[iFiled]); } retObject.Add((ExpandoObject)dataRow); } } return(Json(retObject)); } }
public JsonResult GetDropdownDataForDetailAnalysis() { try { string AppUrl = HttpContext.Request.Headers["appurl"]; string SchemaName = ""; string _SpUserId = HttpContext.Request.Headers["LoggedInUserSPUserId"]; if (!string.IsNullOrEmpty(AppUrl)) { SchemaName = new clsUatClient(_context).GetClientSchema(AppUrl); } else { return(Json("Invalid Url")); } using (var cmd = _context.Database.GetDbConnection().CreateCommand()) { cmd.CommandText = "UAT.spDetailAnalysisDropDown"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@SPUserId", SqlDbType.Int) { Value = _SpUserId }); cmd.Parameters.Add(new SqlParameter("@SchemaName", SqlDbType.VarChar, 500) { Value = SchemaName }); cmd.Parameters.Add(new SqlParameter("@Ret_Parameter", SqlDbType.VarChar, 500) { Direction = ParameterDirection.Output }); if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } var retObject = new List <dynamic>(); TesterList lst = new TesterList(); using (var dataReader = cmd.ExecuteReader()) { while (dataReader.Read()) { var dataRow = new ExpandoObject() as IDictionary <string, object>; for (var iFiled = 0; iFiled < dataReader.FieldCount; iFiled++) { var Name = dataReader.GetName(iFiled); var Value = dataReader.IsDBNull(iFiled) ? null : dataReader[iFiled]; List <clsTestterList> oTester = new List <clsTestterList>(); string valueCheck = Convert.ToString(Value); if (!string.IsNullOrEmpty(valueCheck)) { #region ' XMl Parsing ' if (valueCheck.Contains('<')) { if (Convert.ToString(Name) == "TesterDetailsRowNew") { Name = "lstTesterList"; using (XmlReader reader = XmlReader.Create(new StringReader("<users>" + Value + "</users>"))) { XmlDocument xml = new XmlDocument(); xml.Load(reader); XmlNodeList companyList = xml.GetElementsByTagName("user"); foreach (XmlNode node in companyList) { XmlElement companyElement = (XmlElement)node; oTester.Add(new clsTestterList { testerId = (companyElement.GetElementsByTagName("TUserId") != null) ? Convert.ToString(companyElement.GetElementsByTagName("TUserId")[0].InnerText) : "", testerName = (companyElement.GetElementsByTagName("TUserName") != null) ? Convert.ToString(companyElement.GetElementsByTagName("TUserName")[0].InnerText) : "", roleId = (companyElement.GetElementsByTagName("TRoleId") != null) ? Convert.ToString(companyElement.GetElementsByTagName("TRoleId")[0].InnerText) : "", roleName = (companyElement.GetElementsByTagName("TRoleName") != null) ? Convert.ToString(companyElement.GetElementsByTagName("TRoleName")[0].InnerText) : "" }); } } lst.lstTesterList = oTester; } } #endregion } dataRow.Add(Name, Name == "lstTesterList" ? lst.lstTesterList : Value); } retObject.Add((ExpandoObject)dataRow); } } return(Json(retObject)); } } catch (Exception ex) { return(Json(ex.Message)); } }
public JsonResult ExportTestersParticipation(string projectId) { try { string AppUrl = HttpContext.Request.Headers["appurl"]; string SchemaName = ""; if (!string.IsNullOrEmpty(AppUrl)) { SchemaName = new clsUatClient(_context).GetClientSchema(AppUrl); } else { return(Json("Invalid Url")); } using (var cmd = _context.Database.GetDbConnection().CreateCommand()) { cmd.CommandText = "UAT.spExportTestersParticipation"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@ProjectId", SqlDbType.VarChar, 500) { Value = projectId }); cmd.Parameters.Add(new SqlParameter("@SchemaName", SqlDbType.VarChar, 500) { Value = SchemaName }); cmd.Parameters.Add(new SqlParameter("@Ret_Parameter", SqlDbType.VarChar, 500) { Direction = ParameterDirection.Output }); if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } var retObject = new List <dynamic>(); using (var dataReader = cmd.ExecuteReader()) { while (dataReader.Read()) { var dataRow = new ExpandoObject() as IDictionary <string, object>; for (var iFiled = 0; iFiled < dataReader.FieldCount; iFiled++) { var value = dataReader.GetName(iFiled); var name = dataReader.IsDBNull(iFiled) ? null : dataReader[iFiled]; dataRow.Add(value, Convert.ToString(name)); } retObject.Add((ExpandoObject)dataRow); } } return(Json(retObject)); } } catch (Exception ex) { return(Json(ex.Message)); } }
public List <Area> GetArea() { Dictionary <string, string> _result = new Dictionary <string, string>(); List <Area> areaResult = new List <Area>(); try { string AppUrl = HttpContext.Request.Headers["appurl"]; string SchemaName = ""; if (!string.IsNullOrEmpty(AppUrl)) { SchemaName = new clsUatClient(_context).GetClientSchema(AppUrl); } else { // return Json("Invalid Url"); } using (var cmd = _context.Database.GetDbConnection().CreateCommand()) { cmd.CommandText = "UAT.spRegion"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@StatementType", SqlDbType.VarChar, 500) { Value = "Select" }); SqlParameter outparam = new SqlParameter("@Ret_Parameter", SqlDbType.NVarChar, 500) { Direction = ParameterDirection.Output }; cmd.Parameters.Add(new SqlParameter("@SchemaName", SqlDbType.NVarChar, 500) { Value = SchemaName }); cmd.Parameters.Add(outparam); if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } int retValPos = cmd.ExecuteNonQuery(); string retValue = Convert.ToString(cmd.Parameters["@Ret_Parameter"].Value); using (var dr = cmd.ExecuteReader()) { while (dr.Read()) { //if (dr["areaId"] != null || dr["areaName"] != null) // continue; areaResult.Add(new Area() { areaId = (dr["areaId"] == null) ? "" : Convert.ToString(dr["areaId"]), areaName = (dr["areaName"] == null) ? "" : Convert.ToString(dr["areaName"]), }); } //int areaIdOrdinal = dr.GetOrdinal("areaId"); //int areaNameOrdinal = dr.GetOrdinal("areaName"); //if (dr.IsDBNull(areaIdOrdinal) || dr.IsDBNull(areaNameOrdinal)) // areaResult.Add(new Area() // { // areaId = (dr.IsDBNull(areaIdOrdinal)) == true ? "" : Convert.ToString(dr["areaId"]), // areaName = (dr.IsDBNull(areaNameOrdinal)) == true ? "" : Convert.ToString(dr["areaName"]), // }); } } } catch (Exception ex) { return(null); } // return _result; return(areaResult); }
public Dictionary <string, string> InsertRegisterUser([FromBody] ClsUserRegistration Reg) { Dictionary <string, string> _result = new Dictionary <string, string>(); try { if (string.IsNullOrEmpty(Reg.Email)) { //send service level Exception as service response _result.Add(this._errorText, "Please provide Email"); return(_result); } if (string.IsNullOrEmpty(Reg.ConfirmPassword) || string.IsNullOrEmpty(Reg.Password) || string.IsNullOrEmpty(Reg.FirstName) || string.IsNullOrEmpty(Reg.LastName)) { //send service level Exception as service response _result.Add(this._errorText, "Mandatory Fields data is required"); return(_result); } if ((Reg.ConfirmPassword) != (Reg.Password)) { //send service level Exception as service response _result.Add(this._errorText, "Passwords do not match."); return(_result); } string AppUrl = HttpContext.Request.Headers["appurl"]; string SchemaName = ""; if (!string.IsNullOrEmpty(AppUrl)) { SchemaName = new clsUatClient(_context).GetClientSchema(AppUrl); } else { _result.Add(this._errorText, "Invalid Appurl"); return(_result); } string statementType = string.Empty; if (string.IsNullOrEmpty(Reg.UserId)) { statementType = "Insert"; } else { statementType = "Update"; } using (var cmd = _context.Database.GetDbConnection().CreateCommand()) { cmd.CommandText = "[UAT].[SpUserRegistration]"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@FirstName", SqlDbType.VarChar, 500) { Value = Reg.FirstName }); cmd.Parameters.Add(new SqlParameter("@LastName", SqlDbType.VarChar, 500) { Value = Reg.LastName }); cmd.Parameters.Add(new SqlParameter("@Email", SqlDbType.VarChar, 500) { Value = Reg.Email }); cmd.Parameters.Add(new SqlParameter("@Password", SqlDbType.VarChar, 500) { Value = Reg.Password }); cmd.Parameters.Add(new SqlParameter("@DOB", SqlDbType.VarChar, 500) { Value = (Reg.DOB == "") ? null : Reg.DOB }); cmd.Parameters.Add(new SqlParameter("@Gender", SqlDbType.VarChar, 500) { Value = Reg.Gender }); cmd.Parameters.Add(new SqlParameter("@MobileNo", SqlDbType.VarChar, 500) { Value = Reg.MobileNo }); cmd.Parameters.Add(new SqlParameter("@Country", SqlDbType.NVarChar, 500) { Value = (Reg.Country == "")? null: Reg.Country }); cmd.Parameters.Add(new SqlParameter("@StatementType", SqlDbType.NVarChar, 500) { Value = statementType }); SqlParameter outparam = new SqlParameter("@Ret_Parameter", SqlDbType.NVarChar, 500) { Direction = ParameterDirection.Output }; cmd.Parameters.Add(new SqlParameter("@SchemaName", SqlDbType.NVarChar, 500) { Value = SchemaName }); cmd.Parameters.Add(outparam); if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } int retValPos = cmd.ExecuteNonQuery(); string ReturnParamValue = Convert.ToString(cmd.Parameters["@Ret_Parameter"].Value); if (!string.IsNullOrEmpty(ReturnParamValue) || ReturnParamValue.ToLower() == "Email Already Exist..!!") { string[] arr = ReturnParamValue.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries); if (arr.Length == 1) { /*insert*/ _result.Add(this._statusText, "Done"); _result.Add("Email", Reg.Email); } else { _result.Add(this._errorText, "Sorry! This Email is already registered."); return(_result); } } else { _result.Add(this._errorText, "Sorry! Something went wrong, please try again!"); return(_result); } } } catch (Exception ex) { _result.Add(this._errorText, ex.Message); } return(_result); }
public JsonResult DeleteTestStep(string testStepId) { string AppUrl = HttpContext.Request.Headers["appurl"]; string SchemaName = ""; if (!string.IsNullOrEmpty(AppUrl)) { SchemaName = new clsUatClient(_context).GetClientSchema(AppUrl); } else { return(Json("Invalid Url")); } string _clientSchemaName = SchemaName; if (string.IsNullOrEmpty(_clientSchemaName)) { return(null); } Dictionary <string, string> _result = new Dictionary <string, string>(); if (string.IsNullOrEmpty(testStepId)) { Dictionary <string, string> oError = new Dictionary <string, string>(); oError.Add(this._errorText, "TestStepId is required!"); return(Json(oError)); } try { using (var cmd = _context.Database.GetDbConnection().CreateCommand()) { cmd.CommandText = "UAT.spTestStep"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@TestStepId", SqlDbType.VarChar) { Value = testStepId }); cmd.Parameters.Add(new SqlParameter(this._statementTypeParameterName, SqlDbType.VarChar) { Value = "Delete" }); cmd.Parameters.Add(new SqlParameter(this._schemaNameParameterName, SqlDbType.NVarChar, 10) { Value = _clientSchemaName }); SqlParameter outparam = new SqlParameter(this._returnParameter, SqlDbType.NVarChar, 500) { Direction = ParameterDirection.Output }; cmd.Parameters.Add(outparam); if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } //var resp = _context.Database.ExecuteN(); //return Json(ReturnVal.Value); int _res = 0; _res = cmd.ExecuteNonQuery(); var OutValue = outparam.Value; if (_res > 0) { _result.Add(this._statusText, "DONE"); } else { _result.Add(this._errorText, OutValue.ToString()); } if (!string.IsNullOrEmpty(OutValue.ToString()) && OutValue.ToString().ToLower() == "success") { _result.Add(this._statusText, "Done"); } else { Dictionary <string, string> oError = new Dictionary <string, string>(); oError.Add(this._errorText, OutValue.ToString()); return(Json(oError)); } } } catch (Exception ex) { Dictionary <string, string> oError = new Dictionary <string, string>(); oError.Add(this._errorText, ex.Message); return(Json(oError)); } return(Json(_result)); }
public JsonResult GetDropdownDataTestManagement(string spUserID, string tabName) { string AppUrl = HttpContext.Request.Headers["appurl"]; string SchemaName = ""; if (!string.IsNullOrEmpty(AppUrl)) { SchemaName = new clsUatClient(_context).GetClientSchema(AppUrl); } else { return(Json("Invalid Url")); } string _clientSchemaName = SchemaName; if (string.IsNullOrEmpty(_clientSchemaName)) { return(null); } if (string.IsNullOrEmpty(spUserID) || string.IsNullOrEmpty(tabName)) { //ExceptionHelper.TraceServiceLevelException("spUserId and tabName is required!"); return(null); } tabName = tabName.ToLower(); List <GroupPortfolioProjectTestPass> groupPortfolioProjectTestPassResult = new List <GroupPortfolioProjectTestPass>(); try { using (var cmd = _context.Database.GetDbConnection().CreateCommand()) { cmd.CommandText = "UAT.spGetGroupPortfolioProjectTestPassTestManagement"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@TabName", SqlDbType.VarChar) { Value = tabName }); cmd.Parameters.Add(new SqlParameter("@SPUserId", SqlDbType.Int) { Value = spUserID }); cmd.Parameters.Add(new SqlParameter(this._schemaNameParameterName, SqlDbType.NVarChar, 10) { Value = _clientSchemaName }); cmd.Parameters.Add(new SqlParameter("@Ret_Parameter", SqlDbType.VarChar, 4000) { Direction = ParameterDirection.Output }); if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } var retObject = new List <dynamic>(); using (var dr = cmd.ExecuteReader()) { int ProjectLeadOrdinal = dr.GetOrdinal("projectLead"); int projectRoleCollectionOrdinal = -1; try { projectRoleCollectionOrdinal = dr.GetOrdinal("projectRoleCollection"); } catch (Exception e1) { } int projectStakeholderCollectionOrdinal = -1; try { projectStakeholderCollectionOrdinal = dr.GetOrdinal("projectStakeholderCollection"); } catch (Exception e1) { } int testCaseCollectionOrdinal = -1; try { testCaseCollectionOrdinal = dr.GetOrdinal("testCaseCollection"); } catch (Exception e1) { } int projectIdOrdinal = dr.GetOrdinal("projectId"); int testPassIdOrdinal = -1; try { testPassIdOrdinal = dr.GetOrdinal("testPassId"); } catch (Exception e1) { } int testPassNameOrdinal = -1; try { testPassNameOrdinal = dr.GetOrdinal("testPassName"); } catch (Exception e1) { } int testingTypeOrdinal = -1; try { testingTypeOrdinal = dr.GetOrdinal("testingType"); } catch (Exception e1) { } int groupIdOrdinal = dr.GetOrdinal("groupId"); int groupNameOrdinal = dr.GetOrdinal("groupName"); int portfolioIdOrdinal = dr.GetOrdinal("portfolioId"); int portfolioNameOrdinal = dr.GetOrdinal("portfolioName"); int projectNameOrdinal = dr.GetOrdinal("projectName"); int projectVersionOrdinal = dr.GetOrdinal("projectVersion"); int projectStartDateOrdinal = dr.GetOrdinal("projectStartDate"); int projectEndDateOrdinal = dr.GetOrdinal("projectEndDate"); while (dr.Read()) { #region Project Lead Conversion string _projectLeadEmail = (dr.IsDBNull(ProjectLeadOrdinal)) == true ? "" : Convert.ToString(dr[ProjectLeadOrdinal]); #endregion #region Role Conversion string _role = null; if (tabName == "tester") { if (projectRoleCollectionOrdinal >= 0) { _role = (dr.IsDBNull(projectRoleCollectionOrdinal)) == true ? "" : Convert.ToString(dr[projectRoleCollectionOrdinal]); } } else if (tabName == "teststep") { if (projectRoleCollectionOrdinal >= 0) { _role = (dr.IsDBNull(projectRoleCollectionOrdinal)) == true ? "" : Convert.ToString(dr[projectRoleCollectionOrdinal]); } } #endregion #region Stakeholder Conversion string _stakeholder = null; if (tabName == "testpass") { if (projectStakeholderCollectionOrdinal >= 0) { _stakeholder = (dr.IsDBNull(projectStakeholderCollectionOrdinal)) == true ? "" : Convert.ToString(dr[projectStakeholderCollectionOrdinal]); } } #endregion #region Test Case Conversion string _testCase = null; if (tabName == "teststep") { if (testCaseCollectionOrdinal >= 0) { _testCase = (dr.IsDBNull(testCaseCollectionOrdinal)) == true ? "" : Convert.ToString(dr[testCaseCollectionOrdinal]); } } #endregion string _projectId = (dr.IsDBNull(projectIdOrdinal)) == true ? "" : Convert.ToString(dr[projectIdOrdinal]); var project = groupPortfolioProjectTestPassResult.Where(prj => prj.projectId == _projectId).ToList(); if (project.Count == 0) { #region Test Pass Processing List <GroupPortfolioProjectTestPass.TestPass> _testPass = null; if (tabName == "teststep") { _testPass = new List <GroupPortfolioProjectTestPass.TestPass>(); List <GroupPortfolioProjectTestPass.Role> _lstRole = new List <GroupPortfolioProjectTestPass.Role>(); if (!(dr.IsDBNull(testPassIdOrdinal) || dr.IsDBNull(testPassNameOrdinal))) { _testPass.Add(new GroupPortfolioProjectTestPass.TestPass() { testpassId = (dr.IsDBNull(testPassIdOrdinal)) == true ? "" : Convert.ToString(dr[testPassIdOrdinal]), testpassName = (dr.IsDBNull(testPassNameOrdinal)) == true ? "" : Convert.ToString(dr[testPassNameOrdinal]), testingType = (dr.IsDBNull(testingTypeOrdinal)) == true ? "" : Convert.ToString(dr[testingTypeOrdinal]), testCaseList = _testCase, ListRoles = _role }); } } else if (tabName != "testpass") { _testPass = new List <GroupPortfolioProjectTestPass.TestPass>(); if (!(dr.IsDBNull(testPassIdOrdinal) || dr.IsDBNull(testPassNameOrdinal))) { _testPass.Add(new GroupPortfolioProjectTestPass.TestPass() { testpassId = (dr.IsDBNull(testPassIdOrdinal)) == true ? "" : Convert.ToString(dr[testPassIdOrdinal]), testpassName = (dr.IsDBNull(testPassNameOrdinal)) == true ? "" : Convert.ToString(dr[testPassNameOrdinal]), testCaseList = _testCase, }); } } #endregion groupPortfolioProjectTestPassResult.Add(new GroupPortfolioProjectTestPass() { groupId = (dr.IsDBNull(groupIdOrdinal)) == true ? "" : Convert.ToString(dr[groupIdOrdinal]), groupName = (dr.IsDBNull(groupNameOrdinal)) == true ? "" : Convert.ToString(dr[groupNameOrdinal]), portfolioId = (dr.IsDBNull(portfolioIdOrdinal)) == true ? "" : Convert.ToString(dr[portfolioIdOrdinal]), portfolioName = (dr.IsDBNull(portfolioNameOrdinal)) == true ? "" : Convert.ToString(dr[portfolioNameOrdinal]), projectId = _projectId, projectName = (dr.IsDBNull(projectNameOrdinal)) == true ? "" : Convert.ToString(dr[projectNameOrdinal]), projectVersion = (dr.IsDBNull(projectVersionOrdinal)) == true ? "" : Convert.ToString(dr[projectVersionOrdinal]), projectStartDate = (dr.IsDBNull(projectStartDateOrdinal)) == true ? "" : Convert.ToString(dr[projectStartDateOrdinal]), projectEndDate = (dr.IsDBNull(projectEndDateOrdinal)) == true ? "" : Convert.ToString(dr[projectEndDateOrdinal]), leadEmailId = _projectLeadEmail, roleList = _role, stakeholderList = _stakeholder, testPassList = _testPass, }); } else { #region Test Pass Processing if (tabName == "teststep") { if (!(dr.IsDBNull(testPassIdOrdinal) || dr.IsDBNull(testPassNameOrdinal))) { project.First().testPassList.Add(new GroupPortfolioProjectTestPass.TestPass() { testpassId = (dr.IsDBNull(testPassIdOrdinal)) == true ? "" : Convert.ToString(dr[testPassIdOrdinal]), testpassName = (dr.IsDBNull(testPassNameOrdinal)) == true ? "" : Convert.ToString(dr[testPassNameOrdinal]), testingType = (dr.IsDBNull(testingTypeOrdinal)) == true ? "" : Convert.ToString(dr[testingTypeOrdinal]), testCaseList = _testCase, ListRoles = _role }); } } else if (tabName != "testpass") { if (!(dr.IsDBNull(testPassIdOrdinal) || dr.IsDBNull(testPassNameOrdinal))) { project.First().testPassList.Add(new GroupPortfolioProjectTestPass.TestPass() { testpassId = (dr.IsDBNull(testPassIdOrdinal)) == true ? "" : Convert.ToString(dr[testPassIdOrdinal]), testpassName = (dr.IsDBNull(testPassNameOrdinal)) == true ? "" : Convert.ToString(dr[testPassNameOrdinal]), testCaseList = _testCase, }); } } #endregion } } } return(Json(groupPortfolioProjectTestPassResult)); } } catch (Exception ex) { return(Json(ex.Message)); } }
public List <TestPassTesterRoles> GetTestersByTestPassID(string testPassId) { { try { string AppUrl = HttpContext.Request.Headers["appurl"]; string SpUserId = HttpContext.Request.Headers["LoggedInUserSPUserId"]; string SchemaName = ""; List <TestPassTesterRoles> testersResult = new List <TestPassTesterRoles>(); if (!string.IsNullOrEmpty(AppUrl)) { SchemaName = new clsUatClient(_context).GetClientSchema(AppUrl); } else { return(null); } using (var cmd = _context.Database.GetDbConnection().CreateCommand()) { cmd.CommandText = "UAT.spGetTestersByTestPassIds"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@TestPassId", SqlDbType.Int) { Value = testPassId }); SqlParameter outparam = new SqlParameter("@Ret_Parameter", SqlDbType.NVarChar, 500) { Direction = ParameterDirection.Output }; cmd.Parameters.Add(new SqlParameter("@SchemaName", SqlDbType.NVarChar, 500) { Value = SchemaName }); cmd.Parameters.Add(outparam); if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } var retObject = new List <dynamic>(); using (var dr = cmd.ExecuteReader()) { if (dr.HasRows) { while (dr.Read()) { string _testPassId = string.Empty, _spUserId = string.Empty, _areaId = string.Empty, _isTestingInProgress = string.Empty; string _isTestStepAssigned = string.Empty; _testPassId = (dr["testPassId"] == null) ? "" : Convert.ToString(dr["testPassId"]); _spUserId = (dr["spUserId"] == null) ? "" : Convert.ToString(dr["spUserId"]); _areaId = (dr["areaId"] == null) ? "" : Convert.ToString(dr["areaId"]); _isTestingInProgress = int.Parse(dr["totalPassFailCount"].ToString()) == 0 ? "0" : "1"; _isTestStepAssigned = int.Parse(dr["totalAllStatusCount"].ToString()) == 0 ? "0" : "1";//:SD var tester = testersResult.Where(t => t.testPassId == _testPassId && t.spUserId == _spUserId && t.areaId == _areaId).ToList(); List <TestPassTesterRoles.Role> _role = new List <TestPassTesterRoles.Role>(); if (tester.Count == 0) { _role.Add(new TestPassTesterRoles.Role() { roleId = (dr["roleId"] == null) ? "" : Convert.ToString(dr["roleId"]), roleName = (dr["roleName"] == null) ? "" : Convert.ToString(dr["roleName"]), isTestingInprogress = _isTestingInProgress, isTestStepsAssigned = _isTestStepAssigned }); testersResult.Add(new TestPassTesterRoles() { testPassId = _testPassId, testerID = (dr["testerID"] == null) ? "" : Convert.ToString(dr["testerID"]), spUserId = _spUserId, testerName = (dr["testerName"] == null) ? "" : Convert.ToString(dr["testerName"]), testerAlias = (dr["testerAlias"] == null) ? "" : Convert.ToString(dr["testerAlias"]), testerEmail = (dr["testerEmail"] == null) ? "" : Convert.ToString(dr["testerEmail"]), areaId = _areaId, areaName = (dr["areaName"] == null) ? "" : Convert.ToString(dr["areaName"]), roleList = _role, }); } else { tester.First().roleList.Add(new TestPassTesterRoles.Role() { roleId = (dr["roleId"] == null) ? "" : Convert.ToString(dr["roleId"]), roleName = (dr["roleName"] == null) ? "" : Convert.ToString(dr["roleName"]), isTestingInprogress = _isTestingInProgress, isTestStepsAssigned = _isTestStepAssigned//:SD }); } } } } return(testersResult); } } catch (Exception ex) { return(null); } } }
//public byte[] GetFileToDownload(int id) public FileContentResult GetFileToDownload(int id, string Url) { byte[] fileContent = new byte[0]; string base64String = ""; Attachment_view obj = new Attachment_view(); try { string SchemaName = ""; string AppUrl = Url; if (!string.IsNullOrEmpty(AppUrl)) { SchemaName = new clsUatClient(_context).GetClientSchema(AppUrl); } else { } var filename = ""; var contentType = ""; using (var cmd = _context.Database.GetDbConnection().CreateCommand()) { cmd.CommandText = "UAT.spGetAttachmentToDownload"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@SchemaName", SqlDbType.NVarChar, 500) { Value = SchemaName }); cmd.Parameters.Add(new SqlParameter("@AttachmentId", SqlDbType.Int, 15) { Value = id }); SqlParameter outparam = new SqlParameter(this._returnParameter, SqlDbType.NVarChar, 500) { Direction = ParameterDirection.Output }; cmd.Parameters.Add(outparam); if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } using (var dataReader = cmd.ExecuteReader()) { while (dataReader.Read()) { filename = dataReader["FileName"].ToString(); contentType = dataReader["ContentType"].ToString(); fileContent = (byte[])dataReader["FileData"]; base64String = Convert.ToBase64String(fileContent, 0, fileContent.Length); Response.ContentType = contentType; Response.Headers.Add("content-disposition", "inline;filename=" + dataReader["FileName"].ToString());//fordownload directly//Response.Headers.Add("content-disposition", "attachment;filename=" + dataReader["FileName"].ToString()); Response.Body.WriteAsync(fileContent, 0, fileContent.Length); // Response.WriteAsync("data:" + contentType + ";base64," + base64String); } //obj.fileData = "data:" + contentType + ";base64," + base64String; //return Json(obj); return(File(fileContent, contentType, filename)); } } } catch (Exception ex) { return(null); } //return Json(base64String); // return fileContent; }
public List <TestCase> GetTestCaseDetailForTestPassId_old(string testPassId) { Dictionary <string, string> _result = new Dictionary <string, string>(); List <TestCase> listTestCaseDetails = new List <TestCase>(); try { string AppUrl = HttpContext.Request.Headers["appurl"]; string SchemaName = ""; if (!string.IsNullOrEmpty(AppUrl)) { SchemaName = new clsUatClient(_context).GetClientSchema(AppUrl); } else { return(listTestCaseDetails); } if (string.IsNullOrEmpty(testPassId)) { Dictionary <string, string> oError = new Dictionary <string, string>(); oError.Add("ERROR", "Test Pass Id is required!"); return(listTestCaseDetails); } using (var cmd = _context.Database.GetDbConnection().CreateCommand()) { cmd.CommandText = "UAT.SpTestCase"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@TestPassId", SqlDbType.VarChar) { Value = testPassId }); cmd.Parameters.Add(new SqlParameter("@StatementType", SqlDbType.VarChar, 500) { Value = "Select" }); cmd.Parameters.Add(new SqlParameter("@Ret_Parameter", SqlDbType.NVarChar, 500) { Direction = ParameterDirection.Output }); cmd.Parameters.Add(new SqlParameter("@SchemaName", SqlDbType.NVarChar, 500) { Value = SchemaName }); if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } var retObject = new List <dynamic>(); using (var dataReader = cmd.ExecuteReader()) { while (dataReader.Read()) { var dataRow = new ExpandoObject() as IDictionary <string, object>; for (var iFiled = 0; iFiled < dataReader.FieldCount; iFiled++) { dataRow.Add(dataReader.GetName(iFiled), dataReader.IsDBNull(iFiled) ? null : dataReader[iFiled]); } retObject.Add((ExpandoObject)dataRow); } } return(listTestCaseDetails); } } catch (Exception ex) { return(null); } // return listTestCaseDetails; return(listTestCaseDetails); }
public JsonResult senddata([FromBody] Attachment_dat attachment) { /********************/ string AppUrl = HttpContext.Request.Headers["appurl"]; Dictionary <string, string> _result = new Dictionary <string, string>(); string SchemaName = ""; int outval; bool isUpload = false; if (!string.IsNullOrEmpty(AppUrl)) { SchemaName = new clsUatClient(_context).GetClientSchema(AppUrl); } else { isUpload = false; } string _clientSchemaName = SchemaName; if (string.IsNullOrEmpty(_clientSchemaName)) { return(null); } using (var cmd = _context.Database.GetDbConnection().CreateCommand()) { cmd.CommandText = "UAT.spUpdateFileDataInAttachment_Core"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@TestStepID", SqlDbType.VarChar, 500) { Value = attachment.TestStepID }); cmd.Parameters.Add(new SqlParameter("@AttachmentId", SqlDbType.Int) { Value = attachment.AttachmentId }); cmd.Parameters.Add(new SqlParameter("@AttachmentName", SqlDbType.VarChar, 500) { Value = attachment.AttachmentName }); cmd.Parameters.Add(new SqlParameter("@Description", SqlDbType.VarChar, 500) { Value = attachment.Description }); cmd.Parameters.Add(new SqlParameter("@SchemaName", SqlDbType.VarChar, 500) { Value = SchemaName }); cmd.Parameters.Add(new SqlParameter("@ResultType", SqlDbType.VarChar, 500) { Value = attachment.ResultType }); cmd.Parameters.Add(new SqlParameter("@StatementType", SqlDbType.VarChar, 500) { Value = attachment.StatementType }); cmd.Parameters.Add(new SqlParameter("@ProjectID", SqlDbType.VarChar, 500) { Value = attachment.ProjectID }); cmd.Parameters.Add(new SqlParameter("@TestPassID", SqlDbType.VarChar, 500) { Value = attachment.TestPassID }); cmd.Parameters.Add(new SqlParameter("@TestCaseID", SqlDbType.VarChar, 500) { Value = attachment.TestCaseID }); SqlParameter outparam = new SqlParameter("@outval", SqlDbType.Int) { Direction = ParameterDirection.Output }; cmd.Parameters.Add(outparam); if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } int _res = cmd.ExecuteNonQuery(); // bool outval = (bool)cmd.Parameters["@outval"].Value; outval = Convert.ToInt32(cmd.Parameters["@outval"].Value); if (_res != 0) { isUpload = true; } } return(Json(outval)); }
public JsonResult GetAllAttachment(string testPassId) { List <AttachmentData> listAttachmentData = new List <AttachmentData>(); string AppUrl = HttpContext.Request.Headers["appurl"]; string _SpUserId = HttpContext.Request.Headers["LoggedInUserSPUserId"]; Dictionary <string, string> _result = new Dictionary <string, string>(); string SchemaName = ""; if (!string.IsNullOrEmpty(AppUrl)) { SchemaName = new clsUatClient(_context).GetClientSchema(AppUrl); } else { return(Json("Invalid Url")); } string _clientSchemaName = SchemaName; if (string.IsNullOrEmpty(_clientSchemaName)) { return(null); } List <System.Data.Common.DbParameter> parameter = new List <System.Data.Common.DbParameter>(); /***************************************************************************************/ using (var cmdTP = _context.Database.GetDbConnection().CreateCommand()) { cmdTP.CommandText = "UAT.spGetAttachment_ForTP"; cmdTP.CommandType = CommandType.StoredProcedure; cmdTP.Parameters.Add(new SqlParameter("@TestPassId", SqlDbType.VarChar) { Value = testPassId }); cmdTP.Parameters.Add(new SqlParameter(this._schemaNameParameterName, SqlDbType.NVarChar, 10) { Value = _clientSchemaName }); cmdTP.Parameters.Add(new SqlParameter("@Ret_Parameter", SqlDbType.VarChar, 500) { Direction = ParameterDirection.Output }); if (cmdTP.Connection.State != ConnectionState.Open) { cmdTP.Connection.Open(); } try { using (var drr = cmdTP.ExecuteReader()) { if (drr.HasRows != false) { while (drr.Read()) { listdata_coll.Add(new data_coll() { col_attachmentId = Convert.ToInt32(drr["AttachmentId"]), col_testStepId = drr["TestStepID"].ToString(), col_testCaseId = Convert.ToInt32(drr["TestCaseID"]) }); } } } } catch (Exception ex) { var R = ex; } } /***************************************************************************************/ /*******************************/ using (var cmd = _context.Database.GetDbConnection().CreateCommand()) { cmd.CommandText = "UAT.spGetAttachment_core1"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@TestPassId", SqlDbType.VarChar) { Value = testPassId }); cmd.Parameters.Add(new SqlParameter(this._schemaNameParameterName, SqlDbType.NVarChar, 10) { Value = _clientSchemaName }); cmd.Parameters.Add(new SqlParameter("@Ret_Parameter", SqlDbType.VarChar, 500) { Direction = ParameterDirection.Output }); if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } var retObject = new List <dynamic>(); using (var dr = cmd.ExecuteReader()) { if (dr == null || dr.FieldCount == 0 || dr.HasRows == false) { Dictionary <string, string> oError = new Dictionary <string, string>(); oError.Add(this._errorText, "No Data Found"); return(Json(oError)); } else { int _ER_Attachment_Name = dr.GetOrdinal("ER_Attachment_Name"); int _ER_Attachment_URL = dr.GetOrdinal("ER_Attachment_URL"); int _TestCase_ID = dr.GetOrdinal("TestCase_ID"); int _TestStep_ID = dr.GetOrdinal("TestStep_ID"); //int _a_TestStep_ID = dr.GetOrdinal("TestStepID"); int _TestStep_ActionName = dr.GetOrdinal("TestStep_ActionName"); int _testerSpUserId = dr.GetOrdinal("testerSpUserId"); int _TesterName = dr.GetOrdinal("TesterName"); int _Role_ID = dr.GetOrdinal("Role_ID"); int _Role_Name = dr.GetOrdinal("Role_Name"); int _TestStepPlan_Id = dr.GetOrdinal("TestStepPlan_Id"); int _AR_Attachment1_Name = dr.GetOrdinal("AR_Attachment1_Name"); int _AR_Attachment1_URL = dr.GetOrdinal("AR_Attachment1_URL"); int _AR_Attachment2_Name = dr.GetOrdinal("AR_Attachment2_Name"); int _AR_Attachment2_URL = dr.GetOrdinal("AR_Attachment2_URL"); int _AR_Attachment3_Name = dr.GetOrdinal("AR_Attachment3_Name"); int _AR_Attachment3_URL = dr.GetOrdinal("AR_Attachment3_URL"); int _AttachmentID = dr.GetOrdinal("AttachmentId"); //int _Description = dr.GetOrdinal("Description"); // lstEnv = new List<AttachmentData>(); while (dr.Read()) { List <Attachment> listExpectedAttach = new List <Attachment>(); List <Attachment> listActualAttach = new List <Attachment>(); if (dr.IsDBNull(_ER_Attachment_Name) != true) { listExpectedAttach.Add(new Attachment() { fileName = Convert.ToString(dr["ER_Attachment_Name"]), AttachmentId = getAttaId((dr.IsDBNull(_TestStep_ID)) == true ? "" : Convert.ToString(dr[_TestStep_ID])) }); } if (listExpectedAttach.Count > 0 || listActualAttach.Count > 0) { listAttachmentData.Add(new AttachmentData() { testCaseId = (dr.IsDBNull(_TestCase_ID)) == true ? "" : Convert.ToString(dr[_TestCase_ID]), testStepId = (dr.IsDBNull(_TestStep_ID)) == true ? "" : Convert.ToString(dr[_TestStep_ID]), testStepName = (dr.IsDBNull(_TestStep_ActionName)) == true ? "" : Convert.ToString(dr[_TestStep_ActionName]), testerSpUserId = (dr.IsDBNull(_testerSpUserId)) == true ? "" : Convert.ToString(dr[_testerSpUserId]), testerName = (dr.IsDBNull(_TesterName)) == true ? "" : Convert.ToString(dr[_TesterName]), roleId = (dr.IsDBNull(_Role_ID)) == true ? "" : Convert.ToString(dr[_Role_ID]), roleName = (dr.IsDBNull(_Role_Name)) == true ? "" : Convert.ToString(dr[_Role_Name]), testStepPlanId = (dr.IsDBNull(_TestStepPlan_Id)) == true ? "" : Convert.ToString(dr[_TestStepPlan_Id]), AttachmentID = getAttaId((dr.IsDBNull(_TestStep_ID)) == true ? "" : Convert.ToString(dr[_TestStep_ID])), //(dr.IsDBNull(_AttachmentID)) == true ? "" : Convert.ToString(dr[_AttachmentID]), listExpectedAttach = listExpectedAttach, listActualAttach = listActualAttach, //Description= (dr.IsDBNull(_Description)) == true ? "" : Convert.ToString(dr[_Description]), }); } } } return(Json(listAttachmentData)); } } }
public JsonResult InsertUpdateAttachment([FromBody] Attachment_append attachment) { //string testStepId = null, string testStepPlanId = null, string fileIndex = null string AppUrl = HttpContext.Request.Headers["appurl"]; string _SpUserId = HttpContext.Request.Headers["LoggedInUserSPUserId"]; Dictionary <string, string> _result = new Dictionary <string, string>(); string SchemaName = ""; if (!string.IsNullOrEmpty(AppUrl)) { SchemaName = new clsUatClient(_context).GetClientSchema(AppUrl); } else { return(Json("Invalid Url")); } string _clientSchemaName = SchemaName; if (string.IsNullOrEmpty(_clientSchemaName)) { return(null); } List <ProjectUser> listProjectUsers = new List <ProjectUser>(); string fileType = string.Empty; //attachment.testStepId = null; //attachment.TestStepPlanID = 0; //attachment.FileIndex = 0; //if (string.IsNullOrEmpty(attachment.testStepId) && string.IsNullOrEmpty(attachment.TestStepPlanID)) //{ // //send service level Exception as service response // _result.Add(this._errorText, "testStepId/testStepPlanId is required for Expected/Actual File"); // return Json(_result); //} //else if (string.IsNullOrEmpty(attachment.fileName) && !(attachment.isDelete)) //{ // _result.Add(this._errorText, "fileName is required"); // return Json(_result); //} //else if (string.IsNullOrEmpty(attachment.fileUrl) && !(attachment.isDelete)) //{ // _result.Add(this._errorText,"fileUrl is required"); // return Json(_result); //} //else if (string.IsNullOrEmpty(attachment.fileType)) //{ // _result.Add(this._errorText, "fileType is required"); // return Json(_result); //} List <System.Data.Common.DbParameter> parameter = new List <System.Data.Common.DbParameter>(); using (var cmd = _context.Database.GetDbConnection().CreateCommand()) { /************************************/ tsDataCollection tsDataTable = new tsDataCollection(); if (!string.IsNullOrEmpty(attachment.testStepId)) { int ik = 0; if (attachment.testStepId.IndexOf(',') != -1)// if (attachment.testStepId.Length > 1) { string[] testStepIds = attachment.testStepId.Split(','); foreach (string tsId in testStepIds) { tsDataTable.Add(new clsTestStepIdTableDataTable { RowID = Convert.ToInt32(ik + 1), TestStep_ID = Convert.ToInt32(testStepIds[ik])//Convert.ToInt32(testStepIds) }); ik++; } } else { string testStepIds = attachment.testStepId; tsDataTable.Add(new clsTestStepIdTableDataTable { RowID = Convert.ToInt32(1), TestStep_ID = Convert.ToInt32(testStepIds)//Convert.ToInt32(testStepIds) }); } } /*********************************/ cmd.CommandText = "UAT.spAttachmentInsUpd_Core_1"; cmd.CommandType = CommandType.StoredProcedure; // if (!string.IsNullOrEmpty(attachment.TestStepPlanID)) cmd.Parameters.Add(new SqlParameter("@TestStepPlanID", SqlDbType.Int) { Value = attachment.TestStepPlanID }); // if (!string.IsNullOrEmpty(attachment.FileIndex)) cmd.Parameters.Add(new SqlParameter("@FileIndex", SqlDbType.Int) { Value = attachment.FileIndex }); cmd.Parameters.Add(new SqlParameter("@attID", SqlDbType.Int) { Value = attachment.attID }); cmd.Parameters.Add(new SqlParameter("@isDelete", SqlDbType.VarChar) { Value = attachment.isDelete }); cmd.Parameters.Add(new SqlParameter("@FileType", SqlDbType.VarChar, 500) { Value = attachment.fileType.Trim() }); cmd.Parameters.Add(new SqlParameter("@FileUrl", SqlDbType.VarChar, 500) { Value = attachment.fileUrl }); cmd.Parameters.Add(new SqlParameter("@FileName", SqlDbType.VarChar, 500) { Value = attachment.fileName }); cmd.Parameters.Add(new SqlParameter("@Description", SqlDbType.VarChar, 500) { Value = attachment.Description }); cmd.Parameters.Add(new SqlParameter("@SchemaName", SqlDbType.VarChar, 500) { Value = SchemaName }); cmd.Parameters.Add(new SqlParameter("@UserCId", SqlDbType.Int) { Value = _SpUserId }); cmd.Parameters.Add(new SqlParameter("@TestStepIDs", SqlDbType.Structured) { Value = tsDataTable }); cmd.Parameters.Add(new SqlParameter("@StatementType", SqlDbType.VarChar, 500) { Value = attachment.StatementType }); cmd.Parameters.Add(new SqlParameter("@Ret_Parameter", SqlDbType.VarChar, 500) { Direction = ParameterDirection.Output }); if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } int i = cmd.ExecuteNonQuery(); //bool outval = (bool)cmd.Parameters["@Ret_Parameter"].Value; string outval = (string)cmd.Parameters["@Ret_Parameter"].Value; //if (i != 0 && outval != false) //{ // _result.Add("Status", parameter[parameter.Count - 1].Value.ToString()); //} } return(Json(_result)); }
public FileContentResult GetFileToDownloadActResult(int id, string Url) { byte[] fileContent = new byte[0]; try { string SchemaName = ""; string AppUrl = Url; string matches; string expResultimg; if (!string.IsNullOrEmpty(AppUrl)) { SchemaName = new clsUatClient(_context).GetClientSchema(AppUrl); } var filename = ""; var contentType = ""; using (var cmd = _context.Database.GetDbConnection().CreateCommand()) { cmd.CommandText = "UAT.spGetActResReportToExcelActRes"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@SchemaName", SqlDbType.NVarChar, 500) { Value = SchemaName }); cmd.Parameters.Add(new SqlParameter("@TestStepPlan_Id", SqlDbType.Int, 15) { Value = id }); SqlParameter outparam = new SqlParameter(this._returnParameter, SqlDbType.NVarChar, 500) { Direction = ParameterDirection.Output }; cmd.Parameters.Add(outparam); if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } using (var dataReader = cmd.ExecuteReader()) { while (dataReader.Read()) { string baseStr = dataReader["Actual_Result"].ToString(); matches = baseStr.Split(',')[1]; expResultimg = matches.Split('"')[0]; byte[] imageBytes = Convert.FromBase64String(expResultimg); filename = "abc.png"; contentType = "image/png"; fileContent = imageBytes; Response.ContentType = contentType; Response.Headers.Add("content-disposition", "inline;filename=" + filename); Response.Body.WriteAsync(fileContent, 0, fileContent.Length); } return(File(fileContent, contentType, filename)); } } } catch (Exception ex) { return(null); } }
public JsonResult GetTestCaseDetailForTestPassIdWithTesterFlag(string testPassId) { Dictionary <string, string> _result = new Dictionary <string, string>(); List <TestCase> listTestCaseDetails = new List <TestCase>(); try { string AppUrl = HttpContext.Request.Headers["appurl"]; string SchemaName = ""; if (!string.IsNullOrEmpty(AppUrl)) { SchemaName = new clsUatClient(_context).GetClientSchema(AppUrl); } else { return(Json("Invalid Url")); } using (var cmd = _context.Database.GetDbConnection().CreateCommand()) { cmd.CommandText = "UAT.SpTestCase"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@TestPassId", SqlDbType.Int) { Value = testPassId }); SqlParameter outparam = new SqlParameter("@Ret_Parameter", SqlDbType.NVarChar, 500) { Direction = ParameterDirection.Output }; cmd.Parameters.Add(new SqlParameter("@SchemaName", SqlDbType.NVarChar, 500) { Value = SchemaName }); cmd.Parameters.Add(new SqlParameter("@StatementType", SqlDbType.VarChar, 500) { Value = "Select" });; cmd.Parameters.Add(outparam); if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } int retValPos = cmd.ExecuteNonQuery(); string retValue = Convert.ToString(cmd.Parameters["@Ret_Parameter"].Value); using (var dr = cmd.ExecuteReader()) { if (dr == null || dr.FieldCount == 0) { Dictionary <string, string> oError = new Dictionary <string, string>(); oError.Add("ERROR", "Incorrect Test Pass Id !"); return(Json(oError)); } else { int TestCase_IdOrdinal = dr.GetOrdinal("TestCase_Id"); int TestPass_IdOrdinal = dr.GetOrdinal("TestPass_Id"); int DisplayTestCase_IdOrdinal = dr.GetOrdinal("DisplayTestCase_Id"); int TestCase_NameOrdinal = dr.GetOrdinal("TestCase_Name"); int TestCase_DescriptionOrdinal = dr.GetOrdinal("TestCase_Description"); int Testcase_SequenceOrdinal = dr.GetOrdinal("Testcase_Sequence"); int ETTOrdinal = dr.GetOrdinal("ETT"); string flagTester = ""; if (retValue == "SUCCESS") { flagTester = "y"; } else if (retValue == "No Tester(s) Assigned!") { flagTester = "n"; } while (dr.Read()) { listTestCaseDetails.Add(new TestCase() { testCaseDesp = (dr.IsDBNull(TestCase_DescriptionOrdinal)) == true ? "" : Convert.ToString(dr[TestCase_DescriptionOrdinal]), testCaseDisplayId = (dr.IsDBNull(DisplayTestCase_IdOrdinal)) == true ? "" : Convert.ToString(dr[DisplayTestCase_IdOrdinal]), testCaseETT = (dr.IsDBNull(ETTOrdinal)) == true ? "" : Convert.ToString(dr[ETTOrdinal]), testcaseflagTester = flagTester, testCaseId = (dr.IsDBNull(TestCase_IdOrdinal)) == true ? "" : Convert.ToString(dr[TestCase_IdOrdinal]), testCaseName = (dr.IsDBNull(TestCase_NameOrdinal)) == true ? "" : Convert.ToString(dr[TestCase_NameOrdinal]), testCaseSeq = (dr.IsDBNull(Testcase_SequenceOrdinal)) == true ? "" : Convert.ToString(dr[Testcase_SequenceOrdinal]), testPassId = (dr.IsDBNull(TestPass_IdOrdinal)) == true ? "" : Convert.ToString(dr[TestPass_IdOrdinal]) }); } } } } } catch (Exception ex) { return(Json(ex.Message)); } return(Json(listTestCaseDetails)); }
public JsonResult GetUserInfo(string spuserid) { List <UserInfo> userInfoObj = new List <UserInfo>(); string AppUrl = HttpContext.Request.Headers["appurl"]; string _SpUserId = HttpContext.Request.Headers["LoggedInUserSPUserId"]; string SchemaName = ""; if (!string.IsNullOrEmpty(AppUrl)) { SchemaName = new clsUatClient(_context).GetClientSchema(AppUrl); } else { return(Json("Invalid Url")); } using (var cmd = _context.Database.GetDbConnection().CreateCommand()) { cmd.CommandText = "UAT.sp_GetUserInfo"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@SpUserId", SqlDbType.VarChar) { Value = spuserid }); cmd.Parameters.Add(new SqlParameter("@SchemaName", SqlDbType.NVarChar, 10) { Value = SchemaName }); //cmd.Parameters.Add(new SqlParameter(this._returnParameter, SqlDbType.VarChar, 500) { Direction = ParameterDirection.Output }); if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } var retObject = new List <dynamic>(); var n_fname = ""; var n_lname = ""; using (var dataReader = cmd.ExecuteReader()) { while (dataReader.Read()) { if (dataReader["FirstName"] != null) { n_fname = Convert.ToString(dataReader["FirstName"]); } if (dataReader["LastName"] != null) { n_lname = Convert.ToString(dataReader["LastName"]); } userInfoObj.Add(new UserInfo() { FirstName = n_fname + " " + n_lname//, }); } } return(Json(userInfoObj)); } ///return Json(userInfoObj); }
public List <Reports> GetReportData(int projectId) { try { string _SpUserId = HttpContext.Request.Headers["LoggedInUserSPUserId"]; string AppUrl = HttpContext.Request.Headers["appurl"]; string SchemaName = ""; if (!string.IsNullOrEmpty(AppUrl)) { SchemaName = new clsUatClient(_context).GetClientSchema(AppUrl); } else { return(null); } List <Reports> listReport = new List <Reports>(); List <ProjectUser> listMgr = new List <ProjectUser>(); using (var cmd = _context.Database.GetDbConnection().CreateCommand()) { cmd.CommandText = "UAT.spGetReport"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@ProjectId", SqlDbType.Int) { Value = projectId }); cmd.Parameters.Add(new SqlParameter("@LoginSpUserId", SqlDbType.Int) { Value = _SpUserId }); cmd.Parameters.Add(new SqlParameter("@SchemaName", SqlDbType.VarChar, 500) { Value = SchemaName }); cmd.Parameters.Add(new SqlParameter("@Ret_Parameter", SqlDbType.VarChar, 500) { Direction = ParameterDirection.Output }); if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } var retObject = new List <dynamic>(); using (var dr = cmd.ExecuteReader()) { Reports Report = null; List <ReportUniqueObject> lstUnique = new List <ReportUniqueObject>(); List <ReportTesterRoleStatus> listRptTesterRoleStatus = null; int tpid = dr.GetOrdinal("TestPass_ID"); int tsid = dr.GetOrdinal("TestStep_ID"); int uid = dr.GetOrdinal("User_Id"); int testPassName = dr.GetOrdinal("TestPass_Name"); int description = dr.GetOrdinal("TestPass_Description"); int TestPassEndDate = dr.GetOrdinal("TestPassEndDate"); int testMgrName = dr.GetOrdinal("TestManager"); int testCaseId = dr.GetOrdinal("TestCase_ID"); int testCaseName = dr.GetOrdinal("TestCase_Name"); int testCaseDesc = dr.GetOrdinal("TestCase_Description"); int testStepName = dr.GetOrdinal("TestStep_ActionName"); int expectedResult = dr.GetOrdinal("Expected_Result"); int testerName = dr.GetOrdinal("Tester"); int teststepPlanId = dr.GetOrdinal("TestStepPlan_Id"); int roleId = dr.GetOrdinal("Role_Id"); int roleName = dr.GetOrdinal("Role_Name"); int actualResult = dr.GetOrdinal("Actual_Result"); int status = dr.GetOrdinal("TestStepStatus"); while (dr.Read()) { Report = new Reports(); lstUnique.Add(new ReportUniqueObject { TPID = tpid, TSID = tsid, UID = uid }); Report.testPassId = (dr.IsDBNull(tpid)) == true ? "" : Convert.ToString(dr["TestPass_ID"]).Trim(); Report.testPassName = (dr.IsDBNull(testPassName)) == true ? "" : Convert.ToString(dr["TestPass_Name"]).Trim(); Report.description = (dr.IsDBNull(description)) == true ? "" : Convert.ToString(dr["TestPass_Description"]).Trim(); Report.dueDate = (dr.IsDBNull(TestPassEndDate)) == true ? "" : Convert.ToString(dr["TestPassEndDate"]).Trim(); Report.testMgrName = (dr.IsDBNull(testMgrName)) == true ? "" : Convert.ToString(dr["TestManager"]).Trim(); Report.testCaseId = (dr.IsDBNull(testCaseId)) == true ? "" : Convert.ToString(dr["TestCase_ID"]).Trim(); Report.testCaseName = (dr.IsDBNull(testCaseName)) == true ? "" : Convert.ToString(dr["TestCase_Name"]).Trim(); Report.testCaseDesc = (dr.IsDBNull(testCaseDesc)) == true ? "" : Convert.ToString(dr["TestCase_Description"]).Trim(); Report.testStepId = (dr.IsDBNull(tsid)) == true ? "" : Convert.ToString(dr["TestStep_ID"]).Trim(); Report.testStepName = (dr.IsDBNull(testStepName)) == true ? "" : Convert.ToString(dr["TestStep_ActionName"]).Trim(); Report.expectedResult = (dr.IsDBNull(expectedResult)) == true ? "" : Convert.ToString(dr["Expected_Result"]).Trim(); Report.testerName = (dr.IsDBNull(testerName)) == true ? "" : Convert.ToString(dr["Tester"]).Trim(); Report.testerId = (dr.IsDBNull(uid)) == true ? "" : Convert.ToString(dr["User_Id"]).Trim(); listRptTesterRoleStatus = new List <ReportTesterRoleStatus>(); listRptTesterRoleStatus.Add(new ReportTesterRoleStatus() { teststepPlanId = (dr.IsDBNull(teststepPlanId) == true ? "" : Convert.ToString(dr["TestStepPlan_Id"])), roleId = (dr.IsDBNull(roleId) == true ? "" : Convert.ToString(dr["Role_Id"])), roleName = (dr.IsDBNull(roleName) == true ? "" : Convert.ToString(dr["Role_Name"])), actualResult = (dr.IsDBNull(actualResult) == true ? "" : Convert.ToString(dr["Actual_Result"])), status = (dr.IsDBNull(status) == true ? "" : Convert.ToString(dr["TestStepStatus"])), }); Report.listRptTesterRoleStatus = listRptTesterRoleStatus; listReport.Add(Report); } } return(listReport); } } catch (Exception ex) { return(null); } }
public Dictionary <string, string> InsertUpdateTestCase([FromBody] TestCase oTestCase) { Dictionary <string, string> _result = new Dictionary <string, string>(); try { if (string.IsNullOrEmpty(oTestCase.testCaseName)) { //send service level Exception as service response _result.Add(this._errorText, "testCaseName is required"); return(_result); } string AppUrl = HttpContext.Request.Headers["appurl"]; string SchemaName = ""; if (!string.IsNullOrEmpty(AppUrl)) { SchemaName = new clsUatClient(_context).GetClientSchema(AppUrl); } else { _result.Add(this._errorText, "Invalid Appurl"); return(_result); } string statementType = string.Empty; if (string.IsNullOrEmpty(oTestCase.testCaseId)) { statementType = "Insert"; } else { statementType = "Update"; } using (var cmd = _context.Database.GetDbConnection().CreateCommand()) { cmd.CommandText = "UAT.SpTestCase"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@TestCaseId", SqlDbType.Int) { Value = oTestCase.testCaseId }); cmd.Parameters.Add(new SqlParameter("@TestPassId", SqlDbType.Int) { Value = oTestCase.testPassId }); cmd.Parameters.Add(new SqlParameter("@TestCaseName", SqlDbType.VarChar, 500) { Value = oTestCase.testCaseName }); cmd.Parameters.Add(new SqlParameter("@DisplayID", SqlDbType.VarChar, 500) { Value = oTestCase.testCaseDisplayId }); cmd.Parameters.Add(new SqlParameter("@Description", SqlDbType.VarChar, 500) { Value = oTestCase.testCaseDesp }); cmd.Parameters.Add(new SqlParameter("@Sequence", SqlDbType.Int) { Value = oTestCase.testCaseSeq }); cmd.Parameters.Add(new SqlParameter("@Ett", SqlDbType.NVarChar, 500) { Value = (oTestCase.testCaseETT == "") ? null : oTestCase.testCaseETT }); cmd.Parameters.Add(new SqlParameter("@StatementType", SqlDbType.NVarChar, 500) { Value = statementType }); SqlParameter outparam = new SqlParameter("@Ret_Parameter", SqlDbType.NVarChar, 500) { Direction = ParameterDirection.Output }; cmd.Parameters.Add(new SqlParameter("@SchemaName", SqlDbType.NVarChar, 500) { Value = SchemaName }); cmd.Parameters.Add(outparam); if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } int retValPos = cmd.ExecuteNonQuery(); string ReturnParamValue = Convert.ToString(cmd.Parameters["@Ret_Parameter"].Value); if (!string.IsNullOrEmpty(ReturnParamValue) || ReturnParamValue.ToLower() == "success") { if (ReturnParamValue.ToLower() == "success") {/*update case*/ _result.Add(this._statusText, "Done"); _result.Add("ID", oTestCase.testCaseId); } else { string[] arr = ReturnParamValue.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries); if (arr.Length == 1) {/*insert*/ _result.Add(this._statusText, "Done"); _result.Add("ID", ReturnParamValue); } else { _result.Add(this._errorText, (ReturnParamValue)); return(_result); } } } } } catch (Exception ex) { _result.Add(this._errorText, ex.Message); } return(_result); }
public List <GrpPortfolioProjectTP> GetTestPassReportPage() { try { string AppUrl = HttpContext.Request.Headers["appurl"]; string _SpUserId = HttpContext.Request.Headers["LoggedInUserSPUserId"]; string SchemaName = ""; if (!string.IsNullOrEmpty(AppUrl)) { SchemaName = new clsUatClient(_context).GetClientSchema(AppUrl); } else { return(null); } using (var cmd = _context.Database.GetDbConnection().CreateCommand()) { cmd.CommandText = "UAT.spGetGroupPortfolioProjectTestPassReportPage"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@SPUserId", SqlDbType.Int) { Value = _SpUserId }); cmd.Parameters.Add(new SqlParameter("@SchemaName", SqlDbType.VarChar, 500) { Value = SchemaName }); cmd.Parameters.Add(new SqlParameter("@Ret_Parameter", SqlDbType.VarChar, 500) { Direction = ParameterDirection.Output }); if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } var retObject = new List <dynamic>(); List <GrpPortfolioProjectTP> groupPortfolioProjectTestPassResult = new List <GrpPortfolioProjectTP>(); using (var dataReader = cmd.ExecuteReader()) { while (dataReader.Read()) { var dataRow = new ExpandoObject() as IDictionary <string, object>; List <TestPassTesterRolesNew> _tester = new List <TestPassTesterRolesNew>(); string _projectLeadEmail = string.Empty; string _projectLeadName = string.Empty; #region Project Lead Conversion if (dataReader["projectLead"] != null) { // Name = "lstprojectLead"; using (XmlReader reader = XmlReader.Create(new StringReader("<users>" + dataReader["projectLead"] + "</users>"))) { XmlDocument xml = new XmlDocument(); xml.Load(reader); XmlNodeList TesterList = xml.GetElementsByTagName("user"); foreach (XmlNode node in TesterList) { if (node["userEmail"] != null) { _projectLeadEmail = node["userEmail"].InnerText; } if (node["userName"] != null) { _projectLeadName = node["userName"].InnerText; } break; } } } #endregion #region Tester Conversion if (dataReader["testersCollection"] != null) { // Name = "lstTesterRole"; using (XmlReader reader = XmlReader.Create(new StringReader("<testers>" + dataReader["testersCollection"] + "</testers>"))) { XmlDocument xml = new XmlDocument(); xml.Load(reader); XmlNodeList TesterList = xml.GetElementsByTagName("tester"); foreach (XmlNode node in TesterList) { XmlElement companyElement = (XmlElement)node; string _spUserId = node["spUserId"].InnerText; if (!string.IsNullOrEmpty(_spUserId)) { var testerCheck = _tester.Where(t => t.spUserId == _spUserId).ToList(); if (testerCheck.Count == 0) { //Add Tester List <TestPassTesterRolesNew.Role> r = new List <TestPassTesterRolesNew.Role>(); if (node["roleId"] != null && node["roleName"] != null) { r.Add(new TestPassTesterRolesNew.Role() { roleId = node["roleId"].InnerText, roleName = node["roleName"].InnerText }); } if (node["testerID"] != null && node["spUserId"] != null) { _tester.Add(new TestPassTesterRolesNew() { spUserId = node["spUserId"].InnerText, testerName = node["testerName"].InnerText, roleList = r }); } } else { testerCheck.First().roleList.Add(new TestPassTesterRolesNew.Role() { roleId = node["roleId"].InnerText, roleName = node["roleName"].InnerText, }); } } } } } #endregion int projectId = dataReader.GetOrdinal("projectId"); int testPassId = dataReader.GetOrdinal("testPassId"); int testPassName = dataReader.GetOrdinal("testPassName"); int testPassDescription = dataReader.GetOrdinal("testpassdescription"); int groupId = dataReader.GetOrdinal("groupId"); int groupName = dataReader.GetOrdinal("groupName"); int portfolioId = dataReader.GetOrdinal("portfolioId"); int portfolioName = dataReader.GetOrdinal("portfolioName"); int projectName = dataReader.GetOrdinal("projectName"); int projectVersion = dataReader.GetOrdinal("projectVersion"); int projectStartDate = dataReader.GetOrdinal("projectStartDate"); int projectEndDate = dataReader.GetOrdinal("projectEndDate"); int projectDesc = dataReader.GetOrdinal("projectDesc"); string _projectId = (dataReader.IsDBNull(projectId)) == true ? "" : Convert.ToString(dataReader["projectId"]); var project = groupPortfolioProjectTestPassResult.Where(prj => prj.projectId == _projectId).ToList(); if (project.Count == 0) { List <GrpPortfolioProjectTP.TestPass> _testPass = new List <GrpPortfolioProjectTP.TestPass>(); if (!(dataReader.IsDBNull(testPassId) || dataReader.IsDBNull(testPassName))) { string _testPassId = Convert.ToString(dataReader["testPassId"]); string _testPassName = Convert.ToString(dataReader["testPassName"]); string _testPassDescription = Convert.ToString(dataReader["testpassdescription"]); string _TestManager = Convert.ToString(dataReader["TestManager"]); if (_testPass.Where(obj => obj.testpassId == _testPassId && obj.testpassName == _testPassName).Count() == 0) { _testPass.Add(new GrpPortfolioProjectTP.TestPass() { testpassId = _testPassId, testpassName = _testPassName, testPassDescription = _testPassDescription, TestManager = _TestManager, tester = _tester }); } } groupPortfolioProjectTestPassResult.Add(new GrpPortfolioProjectTP() { groupId = (dataReader.IsDBNull(groupId)) == true ? "" : Convert.ToString(dataReader["groupId"]), groupName = (dataReader.IsDBNull(groupName)) == true ? "" : Convert.ToString(dataReader["groupName"]), portfolioId = (dataReader.IsDBNull(portfolioId)) == true ? "" : Convert.ToString(dataReader["portfolioId"]), portfolioName = (dataReader.IsDBNull(portfolioName)) == true ? "" : Convert.ToString(dataReader["portfolioName"]), projectId = _projectId, projectName = (dataReader.IsDBNull(projectName)) == true ? "" : Convert.ToString(dataReader["projectName"]), projectVersion = (dataReader.IsDBNull(projectVersion)) == true ? "" : Convert.ToString(dataReader["projectVersion"]), projectStartDate = (dataReader.IsDBNull(projectStartDate)) == true ? "" : Convert.ToString(dataReader["projectStartDate"]), projectEndDate = (dataReader.IsDBNull(projectEndDate)) == true ? "" : Convert.ToString(dataReader["projectEndDate"]), projectDescription = (dataReader.IsDBNull(projectDesc)) == true ? "" : Convert.ToString(dataReader["projectDesc"]), leadEmailId = _projectLeadEmail, ProjectleadName = _projectLeadName, testPassList = _testPass, }); } else { if (!(dataReader.IsDBNull(testPassId) || dataReader.IsDBNull(testPassName))) { string _testPassId = Convert.ToString(dataReader["testPassId"]); string _testPassName = Convert.ToString(dataReader["testPassName"]); string _testPassDescription = Convert.ToString(dataReader["testpassdescription"]); string _TestManager = Convert.ToString(dataReader["TestManager"]); if (project.First().testPassList.Where(obj => obj.testpassId == _testPassId && obj.testpassName == _testPassName).Count() == 0) { project.First().testPassList.Add(new GrpPortfolioProjectTP.TestPass() { testpassId = _testPassId, testpassName = _testPassName, testPassDescription = _testPassDescription, TestManager = _TestManager, tester = _tester, }); } } } } return(groupPortfolioProjectTestPassResult); } } } catch (Exception ex) { return(null); } }
public List <TestCase> GetTestCaseDetailForTestPassId(string testPassId) { Dictionary <string, string> _result = new Dictionary <string, string>(); List <TestCase> listTestCaseDetails = new List <TestCase>(); try { string AppUrl = HttpContext.Request.Headers["appurl"]; string SchemaName = ""; if (!string.IsNullOrEmpty(AppUrl)) { SchemaName = new clsUatClient(_context).GetClientSchema(AppUrl); } else { return(null); } if (string.IsNullOrEmpty(testPassId)) { Dictionary <string, string> oError = new Dictionary <string, string>(); oError.Add("ERROR", "Test Pass Id is required!"); return(null); } using (var cmd = _context.Database.GetDbConnection().CreateCommand()) { cmd.CommandText = "UAT.SpTestCase"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@TestPassId", SqlDbType.VarChar) { Value = testPassId }); cmd.Parameters.Add(new SqlParameter("@StatementType", SqlDbType.VarChar, 500) { Value = "Select" }); cmd.Parameters.Add(new SqlParameter("@Ret_Parameter", SqlDbType.NVarChar, 500) { Direction = ParameterDirection.Output }); cmd.Parameters.Add(new SqlParameter("@SchemaName", SqlDbType.NVarChar, 500) { Value = SchemaName }); if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } var retObject = new List <dynamic>(); using (var dr = cmd.ExecuteReader()) { while (dr.Read()) { //var dataRow = new ExpandoObject() as IDictionary<string, object>; //for (var iFiled = 0; iFiled < dataReader.FieldCount; iFiled++) //{ // dataRow.Add(dataReader.GetName(iFiled), dataReader.IsDBNull(iFiled) ? null : dataReader[iFiled]); //} listTestCaseDetails.Add(new TestCase { testCaseId = (dr["TestCase_Id"] == null) ? "" : Convert.ToString(dr["TestCase_Id"]), testPassId = (dr["TestPass_Id"] == null) ? "" : Convert.ToString(dr["TestPass_Id"]), testCaseDisplayId = (dr["DisplayTestCase_Id"] == null) ? "" : Convert.ToString(dr["DisplayTestCase_Id"]), testCaseName = (dr["TestCase_Name"] == null) ? "" : Convert.ToString(dr["TestCase_Name"]), testCaseDesp = (dr["TestCase_Description"] == null) ? "" : Convert.ToString(dr["TestCase_Description"]), testCaseSeq = (dr["Testcase_Sequence"] == null) ? "" : Convert.ToString(dr["Testcase_Sequence"]), testCaseETT = (dr["ETT"] == null) ? "" : Convert.ToString(dr["ETT"]) }); // retObject.Add((ExpandoObject)dataRow); } } return(listTestCaseDetails); } } catch (Exception ex) { _result.Add(this._errorText, ex.Message); } return(listTestCaseDetails); // return null; }