private List <Entities.Drug> GetDrugs(IDataReader reader) { var drugs = new List <Entities.Drug>(); while (reader.Read()) { var drugLinkWithDrugRoutes = new DrugsLinkWithDrugRoute(); var drugInfo = new Entities.Drug() { DrugId = DRE.GetNullableInt32(reader, "drug_id", 0), DrugOrXRay = DRE.GetNullableString(reader, "drug_or_xray", "D"), DrugCode = DRE.GetNullableInt32(reader, "drug_code", null), GenericName = DRE.GetNullableString(reader, "generic_name", null), DrugName = DRE.GetNullableString(reader, "drug_name", null), DrugGroupId = DRE.GetNullableInt32(reader, "drug_group_id", null), BrandId = DRE.GetNullableInt32(reader, "brand_id", null), DrugFormulationId = DRE.GetNullableInt32(reader, "drug_formulation_id", null), DrugFormulationCode = DRE.GetNullableString(reader, "drug_formulation_code", null), Strength = DRE.GetNullableString(reader, "strength", null), Unit = DRE.GetNullableString(reader, "unit", null), AdverseEffects = DRE.GetNullableString(reader, "adverse_effects", null), Precautions = DRE.GetNullableString(reader, "precautions", null), Remarks = DRE.GetNullableString(reader, "remarks", null), DrugLinkWithDrugRoutes = drugLinkWithDrugRoutes.GetDrugLinkByDrugId(DRE.GetNullableInt32(reader, "drug_id", 0)) }; drugs.Add(drugInfo); } return(drugs); }
public List <Entities.Drug> SearchDrugsAll() { var drugs = new List <Entities.Drug>(); try { using (DbCommand dbCommand = database.GetStoredProcCommand(DBStoredProcedure.SearchDrugsAll)) { using (IDataReader reader = database.ExecuteReader(dbCommand)) { while (reader.Read()) { var drugLinkWithDrugRoutes = new DrugsLinkWithDrugRoute(); var drug = new Entities.Drug { DrugId = DRE.GetNullableInt32(reader, "drug_id", 0), DrugOrXRay = DRE.GetNullableString(reader, "drug_or_xray", "D"), DrugCode = DRE.GetNullableInt32(reader, "drug_code", null), GenericName = DRE.GetNullableString(reader, "generic_name", null), DrugName = DRE.GetNullableString(reader, "drug_name", null), DrugGroupId = DRE.GetNullableInt32(reader, "drug_group_id", null), BrandId = DRE.GetNullableInt32(reader, "brand_id", null), DrugFormulationId = DRE.GetNullableInt32(reader, "drug_formulation_id", null), DrugFormulationCode = DRE.GetNullableString(reader, "drug_formulation_code", null), Strength = DRE.GetNullableString(reader, "strength", null), Unit = DRE.GetNullableString(reader, "unit", null), AdverseEffects = DRE.GetNullableString(reader, "adverse_effects", null), Precautions = DRE.GetNullableString(reader, "precautions", null), Remarks = DRE.GetNullableString(reader, "remarks", null), DrugLinkWithDrugRoutes = drugLinkWithDrugRoutes.GetDrugLinkByDrugId(DRE.GetNullableInt32(reader, "drug_id", 0)) }; drugs.Add(drug); } } } } catch (Exception ex) { throw ex; } return(drugs); }