public static TMSMedicalHistory Get(System.Int64 mhHistoryId) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; TMSMedicalHistory instance; instance = new TMSMedicalHistory(); db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSMedicalHistory_SELECT"; dbCommand = db.GetStoredProcCommand(sqlCommand, mhHistoryId); // Get results. ds = db.ExecuteDataSet(dbCommand); // Verification. if (ds == null || ds.Tables[0].Rows.Count == 0) { throw new ApplicationException("Could not get TMSMedicalHistory ID:" + mhHistoryId.ToString() + " from Database."); } // Return results. ds.Tables[0].TableName = TABLE_NAME; instance.MapFrom(ds.Tables[0].Rows[0]); return(instance); }
public static TMSMedicalHistory[] Search(System.Int64?mhHistoryId, System.Int64?mhFacultyId, System.Int64?mhSudentId, System.Int64?mhParentId, System.Int32?mhAsthamaLungProblem, System.Int32?mhCancer, System.Int32?mhCardiacDisease, System.Int32?mhDiabetes, System.Int32?mhHistoryOfBackPain, System.Int32?mhHypertension, System.Int32?mhSymptomsAllergy, System.Int32?mhSymptomsCardiovascularChestPain, System.Int32?mhSymptomsConnectiveTiessue, System.Int32?mhSymptomsDiabetes, System.Int32?mhSymptomsWeightGainLoss, System.Int32?mhSymptomsNeurological, System.String mhMedicationAllergiesList, System.String mhMedicationAllergiesCurrentList, System.String mhRiskFallsInjuries, System.String mhExtra1, System.String mhExtra2, System.String mhExtra3, System.DateTime?mhDate, System.Int32?mhStatus) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSMedicalHistory_SEARCH"; dbCommand = db.GetStoredProcCommand(sqlCommand, mhHistoryId, mhFacultyId, mhSudentId, mhParentId, mhAsthamaLungProblem, mhCancer, mhCardiacDisease, mhDiabetes, mhHistoryOfBackPain, mhHypertension, mhSymptomsAllergy, mhSymptomsCardiovascularChestPain, mhSymptomsConnectiveTiessue, mhSymptomsDiabetes, mhSymptomsWeightGainLoss, mhSymptomsNeurological, mhMedicationAllergiesList, mhMedicationAllergiesCurrentList, mhRiskFallsInjuries, mhExtra1, mhExtra2, mhExtra3, mhDate, mhStatus); ds = db.ExecuteDataSet(dbCommand); ds.Tables[0].TableName = TABLE_NAME; return(TMSMedicalHistory.MapFrom(ds)); }
public static TMSMedicalHistory[] MapFrom(DataSet ds) { List <TMSMedicalHistory> objects; // Initialise Collection. objects = new List <TMSMedicalHistory>(); // Validation. if (ds == null) { throw new ApplicationException("Cannot map to dataset null."); } else if (ds.Tables[TABLE_NAME].Rows.Count == 0) { return(objects.ToArray()); } if (ds.Tables[TABLE_NAME] == null) { throw new ApplicationException("Cannot find table [dbo].[TMS_MedicalHistory] in DataSet."); } if (ds.Tables[TABLE_NAME].Rows.Count < 1) { throw new ApplicationException("Table [dbo].[TMS_MedicalHistory] is empty."); } // Map DataSet to Instance. foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows) { TMSMedicalHistory instance = new TMSMedicalHistory(); instance.MapFrom(dr); objects.Add(instance); } // Return collection. return(objects.ToArray()); }
public static TMSMedicalHistory[] MapFrom(DataSet ds) { List<TMSMedicalHistory> objects; // Initialise Collection. objects = new List<TMSMedicalHistory>(); // Validation. if (ds == null) throw new ApplicationException("Cannot map to dataset null."); else if (ds.Tables[TABLE_NAME].Rows.Count == 0) return objects.ToArray(); if (ds.Tables[TABLE_NAME] == null) throw new ApplicationException("Cannot find table [dbo].[TMS_MedicalHistory] in DataSet."); if (ds.Tables[TABLE_NAME].Rows.Count < 1) throw new ApplicationException("Table [dbo].[TMS_MedicalHistory] is empty."); // Map DataSet to Instance. foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows) { TMSMedicalHistory instance = new TMSMedicalHistory(); instance.MapFrom(dr); objects.Add(instance); } // Return collection. return objects.ToArray(); }
public static TMSMedicalHistory Get(System.Int64 mhHistoryId) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; TMSMedicalHistory instance; instance = new TMSMedicalHistory(); db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSMedicalHistory_SELECT"; dbCommand = db.GetStoredProcCommand(sqlCommand, mhHistoryId); // Get results. ds = db.ExecuteDataSet(dbCommand); // Verification. if (ds == null || ds.Tables[0].Rows.Count == 0) throw new ApplicationException("Could not get TMSMedicalHistory ID:" + mhHistoryId.ToString()+ " from Database."); // Return results. ds.Tables[0].TableName = TABLE_NAME; instance.MapFrom( ds.Tables[0].Rows[0] ); return instance; }