public static BplTransactionUserToEstab getbpTransactionUserToEstabyID(string bplUserToEstabTrasactionID) { BplTransactionUserToEstab m = new BplTransactionUserToEstab(); try { SqlCommand command = new SqlCommand("Select * from BplTransactionUserToEstab where bplUserToEstabTrasactionID=@bplUserToEstabTrasactionID"); command.Connection = connection; connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { m.bplUserToEstabTrasactionID = reader["bplUserToEstabTrasactionID"].ToString(); BPMatchUserToEstab es = BPMatchUserToEstabDB.getBloodRequestsMatchbyID(reader["bpMatchUsrEstID"].ToString()); m.bpMatchUsrEstID = es; m.unit = Convert.ToInt32(reader["unitsPossible"]); m.status = reader["status"].ToString(); } reader.Close(); } finally { connection.Close(); } return(m); }
public static List <BplTransactionUserToEstab> getAllbpTransactionUserToEstabyTime(DateTime from, DateTime to) { List <BplTransactionUserToEstab> matches = new List <BplTransactionUserToEstab>(); try { SqlCommand command = new SqlCommand("Select * from BplTransactionUserToEstab WHERE requestDate BETWEEN @fromdate AND @todate"); command.Connection = connection; connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { BplTransactionUserToEstab m = new BplTransactionUserToEstab(); m.bplUserToEstabTrasactionID = reader["bplUserToEstabTrasactionID"].ToString(); BPMatchUserToEstab es = BPMatchUserToEstabDB.getBloodRequestsMatchbyID(reader["bpMatchUsrEstID"].ToString()); m.bpMatchUsrEstID = es; m.unit = Convert.ToInt32(reader["unitsPossible"]); m.status = reader["status"].ToString(); matches.Add(m); } reader.Close(); } finally { connection.Close(); } return(matches); }