public static ReceiptInfoEntity Get(string id) { var sql = string.Format(@"SELECT {0} FROM receipt_info WHERE id = @p_id ", COLUMN_SQL); var db = DatabaseFactory.CreateDatabase(); var dc = db.GetSqlStringCommand(sql); db.AddInParameter(dc, "p_id", DbType.String, id); var list = new List <ReceiptInfoEntity>(); using (var reader = db.ExecuteReader(dc)) { while (reader.Read()) { var entity = new ReceiptInfoEntity(); entity.Init(reader); return(entity); } return(null); } }
public static IList <ReceiptInfoEntity> GetByHospital(string hospitalId) { var sql = string.Format(@"SELECT {0} FROM receipt_info WHERE hospital_id = @p_hospital_id ORDER BY TITLE", COLUMN_SQL); var db = DatabaseFactory.CreateDatabase(); var dc = db.GetSqlStringCommand(sql); db.AddInParameter(dc, "p_hospital_id", DbType.String, hospitalId); var list = new List <ReceiptInfoEntity>(); using (var reader = db.ExecuteReader(dc)) { while (reader.Read()) { var entity = new ReceiptInfoEntity(); entity.Init(reader); list.Add(entity); } } return(list); }