public IHttpActionResult SearchBatchMatchingAssessors(SearchBatchMatchingAssessorRequestParams searchParams) { if (searchParams == null) { searchParams = new SearchBatchMatchingAssessorRequestParams(); } return(Ok(GetBatchAllocationDbService().GetBatchMatchingAssessors(searchParams))); }
BatchMatchingAssessorResponse IBatchAllocationDbService.GetBatchMatchingAssessors(SearchBatchMatchingAssessorRequestParams request) { BatchMatchingAssessorResponse batchMatchingAssessorResponse = new BatchMatchingAssessorResponse(); try { var dbSet = GetDbConnector().LoadDataSet("SearchAssessorForBatchMaster", QueryCommandType.StoredProcedure, new List <System.Data.IDbDataParameter> { new SqlParameter() { ParameterName = "@BatchId", Value = request.BatchId, SqlDbType = SqlDbType.VarChar, Size = 10 }, new SqlParameter() { ParameterName = "@BatchName", Value = request.BatchName, SqlDbType = SqlDbType.VarChar, Size = 100 }, new SqlParameter() { ParameterName = "@AssessorName", Value = request.AssessorName, SqlDbType = SqlDbType.VarChar, Size = 200 }, new SqlParameter() { ParameterName = "@AssessmentDate", Value = request.AssessmentDate, SqlDbType = SqlDbType.DateTime }, new SqlParameter() { ParameterName = "@Timing", Value = request.AssessmentTiming, SqlDbType = SqlDbType.Bit } }); //Comment : Here fill & return generic list from DbSet var listAssessor = new List <ASSESSOR.Assessor>(); if (dbSet != null && dbSet.Tables.Count > 0) { Int64 assessorId = 0; foreach (DataRow dataRow in dbSet.Tables[0].Rows) { //hold assessor-id assessorId = Convert.ToInt64(dataRow["AssessorId"]); listAssessor.Add( new ASSESSOR.Assessor() { Id = assessorId, //Comment": Here data for BatchDetails PerosnalDetail = new ASSESSOR.AssessorPersonalDetail() { AssessorId = assessorId, Name = dataRow["AssessorName"].ToString(), }, CommunicationDetail = new ASSESSOR.AssessorCommunicationDetail() { AssessorId = assessorId, EmailId = dataRow["EmailId"].ToString(), MobileNo = dataRow["MobileNo"].ToString(), WhatsAppNo = dataRow["WhatsAppNo"].ToString(), StateName = dataRow["AssessorStateName"].ToString(), CityName = dataRow["AssessorCityName"].ToString(), }, }); } } //assign fecthed list batchMatchingAssessorResponse.Assessors = listAssessor; batchMatchingAssessorResponse.OperationStatus = new OperationStatus { ServiceName = "GetBatchMetchingAssessor", ServiceMethod = "Get", RequestProcessed = true, RequestSuccessful = true }; } catch (Exception ex) { batchMatchingAssessorResponse.OperationStatus = new OperationStatus { Messages = new List <Message>() { new Message() { DTOName = "BatchAllocation", DTOProperty = "", MessageType = MessageType.SystemError, Text = ex.Message } }, RequestProcessed = true, RequestSuccessful = false }; } return(batchMatchingAssessorResponse); }