public List <PrevRateDM> Read(SqlParameter[] parameters, string statement) { using (SqlConnection connection = new SqlConnection(connectionString)) { using (SqlCommand command = new SqlCommand(statement, connection)) { command.CommandType = CommandType.StoredProcedure; if (parameters != null) { command.Parameters.AddRange(parameters); } connection.Open(); SqlDataReader data = command.ExecuteReader(); List <PrevRateDM> prevs = new List <PrevRateDM>(); while (data.Read()) { PrevRateDM prev = new PrevRateDM(); prev.QuoteId = data["QuoteId"].ToString(); prev.SeqNum = data["SeqNum"].ToString(); prev.UserId = data["UserId"].ToString(); prevs.Add(prev); } return(prevs); } } }
public void AddPrevRate(PrevRateDM PrevRate) { SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@QuoteId", PrevRate.QuoteId) , new SqlParameter("@SeqNum", PrevRate.SeqNum) , new SqlParameter("@UserId", PrevRate.UserId) }; dataWriter.Write(parameters, "AddPrevRate"); logs.LogError("Event", "An PrevRate has been added to the database", "Class:PrevRateDAO, Method:AddPrevRate"); }