public IEnumerable <InboundModel> Search(InboundSearchModel inboundSearchModel) { string redHawkTokenUsername = Request.Headers.GetValues("redHawkTokenUsername").First(); string redHawkTokenPassword = Request.Headers.GetValues("redHawkTokenPassword").First(); var validUser = accountController.ValidateRedHawkToken(redHawkTokenUsername, redHawkTokenPassword); if (validUser) { return(inboundDAL.InboundSearch(inboundSearchModel)); } else { return(null); } }
public IEnumerable <InboundModel> InboundSearch(InboundSearchModel inboundSearchModel) { try { List <InboundModel> inboundModelList = new List <InboundModel>(); SqlConnection sqlConnection = new SqlConnection(sqlConnectionString); SqlCommand sqlCommand = new SqlCommand("assp_CEAInboundXMLSearch", sqlConnection); sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.Parameters.AddWithValue("@CompanionPolicyNumber", inboundSearchModel.CompanionPolicyNumber); sqlCommand.Parameters.AddWithValue("@FileName", inboundSearchModel.FileName); sqlCommand.Parameters.AddWithValue("@CompanyId", inboundSearchModel.CompanyId); sqlCommand.Parameters.AddWithValue("@CEAXMLId", inboundSearchModel.CeaXmlId); sqlCommand.Parameters.AddWithValue("@FileDate", inboundSearchModel.FileDate); sqlCommand.Parameters.AddWithValue("@TransactionType", inboundSearchModel.TransactionType); sqlCommand.Parameters.AddWithValue("@ProcessingStatus", inboundSearchModel.ProcessingStatus); sqlConnection.Open(); SqlDataReader rdr = sqlCommand.ExecuteReader(); while (rdr.Read()) { InboundModel inboundModel = new InboundModel(); inboundModel.CeaXmlId = Convert.ToInt32(rdr["CEA_xml_id"]); inboundModel.PolicyId = Convert.ToInt32(rdr["policy_id"]); inboundModel.CompanyId = Convert.ToInt32(rdr["company_id"]); inboundModel.PolicyNumber = rdr["policy_number"].ToString(); inboundModel.FileName = rdr["filename"].ToString(); inboundModel.TransactionType = rdr["transactiontype"].ToString(); inboundModel.ProcessingStatus = rdr["proccessingstatus"].ToString(); inboundModel.PolicyExpirationDate = rdr["policy_expiration_date"].ToString(); inboundModel.PolicyEffectiveDate = rdr["policy_effective_date"].ToString(); inboundModel.CompanionPolicyNumber = rdr["companion_policy_number"].ToString(); inboundModelList.Add(inboundModel); } sqlConnection.Close(); return(inboundModelList); } catch (Exception ex) { throw ex; } }