public Entities.PreEmploymentDetails GetPatientAndTestDetails(Int32 patientId) { var patientAndTestDetails = new Entities.PreEmploymentDetails(); try { using (DbCommand dbCommand = database.GetStoredProcCommand(DBStoredProcedure.GetPreEmploymentPatientDetailsByPatientId)) { database.AddInParameter(dbCommand, "@patient_id", DbType.Int32, patientId); using (IDataReader reader = database.ExecuteReader(dbCommand)) { while (reader.Read()) { var preEmploymentTestDetails = new DataModel.PreEmploymentTestDetails(); var preEmployment = new Entities.PreEmploymentDetails() { PreEmploymentId = DRE.GetNullableInt32(reader, "pre_employment_id", 0), PreEmploymentCodeNo = DRE.GetNullableInt32(reader, "pre_employment_code_no", 0), PatientId = DRE.GetNullableInt32(reader, "patient_id", null), PatientCode = DRE.GetNullableInt32(reader, "patient_code", null), PatientFullName = DRE.GetNullableString(reader, "full_name", null), Gender = DRE.GetNullableString(reader, "gender", null), Age = DRE.GetNullableInt32(reader, "age", null), ConsultDate = DRE.GetNullableString(reader, "consult_date", null), MaritalStatus = DRE.GetNullableString(reader, "marital_status", null), NoOfSons = DRE.GetNullableInt32(reader, "no_of_sons", null), NoOfDaughters = DRE.GetNullableInt32(reader, "no_of_daughters", null), EmployerId = DRE.GetNullableInt32(reader, "employer_id", null), EmployerCode = DRE.GetNullableInt32(reader, "employer_code", null), EmployerName = DRE.GetNullableString(reader, "employer_name", null), Designation = DRE.GetNullableString(reader, "designation", null), IdentificationMark = DRE.GetNullableString(reader, "identification_mark", null), AllergicTo = DRE.GetNullableString(reader, "allergic_to", null), Micturation = DRE.GetNullableString(reader, "micturation", null), Bowels = DRE.GetNullableString(reader, "bowels", null), Sleep = DRE.GetNullableString(reader, "sleep", null), Alcohol = DRE.GetNullableString(reader, "alcohol", null), Smoking = DRE.GetNullableString(reader, "smoking", null), MC = DRE.GetNullableString(reader, "mc", null), PastHistory = DRE.GetNullableString(reader, "past_history", null), FamilyHistory = DRE.GetNullableString(reader, "family_history", null), WorkingPeriodId = DRE.GetNullableInt32(reader, "working_period_id", null), FinancialYear = DRE.GetNullableString(reader, "financial_year", null), PreEmploymentTestDetails = preEmploymentTestDetails.GetAllTestDetails() }; patientAndTestDetails = preEmployment; } } } } catch (Exception e) { throw e; } return(patientAndTestDetails); }
public List <Entities.PreEmploymentDetails> SearchPreEmploymentDetails(Entities.PreEmploymentDetails preEmploymentDetails) { var preEmploymentDetailsList = new List <Entities.PreEmploymentDetails>(); try { using (DbCommand dbCommand = database.GetStoredProcCommand(DBStoredProcedure.SearchPreEmploymentDetails)) { database.AddInParameter(dbCommand, "@pre_employment_or_health_checkup", DbType.String, preEmploymentDetails.PreEmploymentOrHealthCheckup); database.AddInParameter(dbCommand, "@financial_year", DbType.String, preEmploymentDetails.FinancialYear); database.AddInParameter(dbCommand, "@first_name", DbType.String, preEmploymentDetails.FirstName); database.AddInParameter(dbCommand, "@last_name", DbType.String, preEmploymentDetails.LastName); database.AddInParameter(dbCommand, "@consult_from_date", DbType.String, preEmploymentDetails.ConsultFromDate); database.AddInParameter(dbCommand, "@consult_to_date", DbType.String, preEmploymentDetails.ConsultToDate); using (IDataReader reader = database.ExecuteReader(dbCommand)) { while (reader.Read()) { var preEmploymentTestDetails = new DataModel.PreEmploymentTestDetails(); var preEmployment = new Entities.PreEmploymentDetails() { PreEmploymentId = DRE.GetNullableInt32(reader, "pre_employment_id", 0), PreEmploymentCodeNo = DRE.GetNullableInt32(reader, "pre_employment_code_no", null), PreEmploymentOrHealthCheckup = DRE.GetNullableString(reader, "pre_employment_or_health_checkup", null), PatientId = DRE.GetNullableInt32(reader, "patient_id", null), PatientCode = DRE.GetNullableInt32(reader, "patient_code", null), PatientFullName = DRE.GetNullableString(reader, "full_name", null), Gender = DRE.GetNullableString(reader, "gender", null), Age = DRE.GetNullableInt32(reader, "age", null), ConsultDate = DRE.GetNullableString(reader, "consult_date", null), MaritalStatus = DRE.GetNullableString(reader, "marital_status", null), NoOfSons = DRE.GetNullableInt32(reader, "no_of_sons", null), NoOfDaughters = DRE.GetNullableInt32(reader, "no_of_daughters", null), EmployerId = DRE.GetNullableInt32(reader, "employer_id", null), EmployerCode = DRE.GetNullableInt32(reader, "employer_code", null), EmployerName = DRE.GetNullableString(reader, "employer_name", null), Designation = DRE.GetNullableString(reader, "designation", null), IdentificationMark = DRE.GetNullableString(reader, "identification_mark", null), AllergicTo = DRE.GetNullableString(reader, "allergic_to", null), Micturation = DRE.GetNullableString(reader, "micturation", null), Bowels = DRE.GetNullableString(reader, "bowels", null), Sleep = DRE.GetNullableString(reader, "sleep", null), Alcohol = DRE.GetNullableString(reader, "alcohol", null), Smoking = DRE.GetNullableString(reader, "smoking", null), MC = DRE.GetNullableString(reader, "mc", null), PastHistory = DRE.GetNullableString(reader, "past_history", null), FamilyHistory = DRE.GetNullableString(reader, "family_history", null), OtherDetails = DRE.GetNullableString(reader, "other_details", null), Remarks = DRE.GetNullableString(reader, "remarks", null), WorkingPeriodId = DRE.GetNullableInt32(reader, "working_period_id", null), FinancialYear = DRE.GetNullableString(reader, "financial_year", null), PreEmploymentTestDetails = preEmploymentTestDetails.GetPreEmploymentTestDetailsByPreEmploymentId(DRE.GetInt32(reader, "pre_employment_id")) }; preEmploymentDetailsList.Add(preEmployment); } } } } catch (Exception e) { throw e; } return(preEmploymentDetailsList); }