/// <summary> /// /// </summary> /// <param name="employerId"></param> /// <returns></returns> public Entities.Employer GetEmployerDetailsById(Int32 employerId) { var employer = new Entities.Employer(); using (DbCommand dbCommand = database.GetStoredProcCommand(DBStoredProcedure.GetEmployerDetailsById)) { database.AddInParameter(dbCommand, "@employer_id", DbType.Int32, employerId); using (IDataReader reader = database.ExecuteReader(dbCommand)) { while (reader.Read()) { var _employer = new Entities.Employer { EmployerId = DRE.GetNullableInt32(reader, "employer_id", null), EmployerName = DRE.GetNullableString(reader, "employer_name", null), EmployerAddress = DRE.GetNullableString(reader, "employer_address", null), CountryId = DRE.GetNullableInt32(reader, "country_id", null), StateId = DRE.GetNullableInt32(reader, "state_id", null), CityId = DRE.GetNullableInt32(reader, "city_id", null), PinCode = DRE.GetNullableString(reader, "pin_code", null), Website = DRE.GetNullableString(reader, "website", null), GSTINNo = DRE.GetNullableString(reader, "gstin_no", null) }; employer = _employer; } } } return(employer); }
public List <Entities.DrugGroup> SearchDrugGroupsByGroupName(string groupName) { var drugGroups = new List <Entities.DrugGroup>(); try { using (DbCommand dbCommand = database.GetStoredProcCommand(DBStoredProcedure.SearchDrugGroupByName)) { database.AddInParameter(dbCommand, "@group_name", DbType.String, groupName); using (IDataReader reader = database.ExecuteReader(dbCommand)) { while (reader.Read()) { var drugGroup = new Entities.DrugGroup { DrugGroupId = DRE.GetNullableInt32(reader, "drug_group_id", 0), GroupName = DRE.GetNullableString(reader, "group_name", null) }; drugGroups.Add(drugGroup); } } } } catch (Exception ex) { throw ex; } return(drugGroups); }
/// <summary> /// /// </summary> /// <param name="drugRouteName"></param> /// <returns></returns> public Entities.DrugRoutes GetDrugRouteDetailsByName(string drugRouteName) { var drugRouteDetails = new Entities.DrugRoutes(); using (DbCommand dbCommand = database.GetStoredProcCommand(DBStoredProcedure.GetDetailsOfDrugRouteByName)) { database.AddInParameter(dbCommand, "@drug_route_name", DbType.String, drugRouteName); using (IDataReader reader = database.ExecuteReader(dbCommand)) { while (reader.Read()) { var drugRoute = new Entities.DrugRoutes { DrugRouteId = DRE.GetNullableInt32(reader, "drug_route_id", 0), RouteName = DRE.GetNullableString(reader, "route_name", null) }; drugRouteDetails = drugRoute; } } } return(drugRouteDetails); }
public List <Entities.AccountHead> GetAllAccountHeads() { var accountHeads = new List <Entities.AccountHead>(); try { using (DbCommand dbCommand = database.GetStoredProcCommand(DBStoredProcedure.GetAllAccountHeads)) { using (IDataReader reader = database.ExecuteReader(dbCommand)) { while (reader.Read()) { var accountHead = new Entities.AccountHead { AccountHeadId = DRE.GetNullableInt32(reader, "account_head_id", 0), AccountHeadName = DRE.GetNullableString(reader, "account_head_name", null) }; accountHeads.Add(accountHead); } } } } catch (Exception ex) { throw ex; } return(accountHeads); }
/// <summary> /// /// </summary> /// <returns></returns> public List <Entities.ClientAddress> GetAllClientAddressessByClientId(Int32 clientId) { var clientAddresses = new List <Entities.ClientAddress>(); DbCommand dbCommand = null; try { using (dbCommand = database.GetStoredProcCommand(DBStoredProcedure.GetAllClientAddressByClientId)) { database.AddInParameter(dbCommand, "@client_id", DbType.Int32, clientId); using (IDataReader reader = database.ExecuteReader(dbCommand)) { while (reader.Read()) { //var customerAndTransporterMapping = new CustomerAndTransporterMapping(); var clientAddress = new Entities.ClientAddress { ClientId = DRE.GetNullableInt32(reader, "client_id", 0), ClientName = DRE.GetNullableString(reader, "client_name", null), ClientTypeId = DRE.GetNullableInt32(reader, "client_type_id", null), ClientType = DRE.GetNullableString(reader, "client_type", null), AddressTypeId = DRE.GetNullableInt32(reader, "address_type_id", 0), AddressType = DRE.GetNullableString(reader, "address_type", null), ClientAddressCode = DRE.GetNullableString(reader, "client_address_code", null), ClientAddressId = DRE.GetNullableInt32(reader, "client_address_id", 0), ClientAddressName = DRE.GetNullableString(reader, "client_address_name", null), Address = DRE.GetNullableString(reader, "address", null), CountryId = DRE.GetNullableInt32(reader, "country_id", null), CountryName = DRE.GetNullableString(reader, "country_name", null), StateId = DRE.GetNullableInt32(reader, "state_id", 0), StateName = DRE.GetNullableString(reader, "state_name", null), CityId = DRE.GetNullableInt32(reader, "city_id", 0), CityName = DRE.GetNullableString(reader, "city_name", null), Area = DRE.GetNullableString(reader, "area", null), EmailId = DRE.GetNullableString(reader, "email_id", null), ContactNos = DRE.GetNullableString(reader, "contact_nos", null), GSTNo = DRE.GetNullableString(reader, "gst_no", null), SrNo = DRE.GetNullableInt64(reader, "sr_no", null) //CustomerAndTransporterMapping = customerAndTransporterMapping.GetTransportersListByCustomerAddressId(DRE.GetInt32(reader, "client_address_id")) }; clientAddresses.Add(clientAddress); } } } } catch (Exception ex) { throw ex; } finally { dbCommand = null; } return(clientAddresses); }
public List <Entities.Employee> GetEmployeeIdAndNameByEmployeeName(string employeeName) { List <Entities.Employee> employees = new List <Entities.Employee>(); try { using (DbCommand dbCommand = database.GetStoredProcCommand(DBStoredProcedure.GetEmployeeIdAndNameByEmployeeName)) { database.AddInParameter(dbCommand, "@employee_name", DbType.String, employeeName); using (IDataReader reader = database.ExecuteReader(dbCommand)) { var employee = new Entities.Employee() { EmployeeId = DRE.GetNullableInt32(reader, "@employee_id", null), EmployeeCode = DRE.GetNullableString(reader, "@employee_code", null), CompanyName = DRE.GetNullableString(reader, "@company_name", null), FullName = DRE.GetNullableString(reader, "@full_name", null) }; employees.Add(employee); } } } catch (Exception ex) { throw ex; } return(employees); }
private List <Entities.PurchaseBill> GetPurchaseBills(IDataReader reader) { var purchaseBills = new List <Entities.PurchaseBill>(); while (reader.Read()) { var purchaseBillItem = new PurchaseBillItem(); var purchaseBill = new Entities.PurchaseBill { PurchaseBillId = DRE.GetNullableInt32(reader, "purchase_bill_id", 0), PurchaseBillNo = DRE.GetNullableString(reader, "purchase_bill_no", null), PurchaseBillDate = DRE.GetNullableString(reader, "purchase_bill_date", null), VendorId = DRE.GetNullableInt32(reader, "vendor_id", null), VendorName = DRE.GetNullableString(reader, "vendor_name", null), PurchaseBillAmount = DRE.GetNullableDecimal(reader, "purchase_bill_amount", 0), AdjustedAmount = DRE.GetNullableDecimal(reader, "adjusted_amount", 0), TotalBillQty = DRE.GetNullableDecimal(reader, "total_bill_qty", 0), TotalBillAmount = DRE.GetNullableDecimal(reader, "total_bill_amount", 0), Remarks = DRE.GetNullableString(reader, "remarks", null), WorkingPeriodId = DRE.GetNullableInt32(reader, "working_period_id", null), FinancialYear = DRE.GetNullableString(reader, "financial_year", null), PurchaseBillItems = purchaseBillItem.GetPurchaseBillItemDetailsByPurchaseBillId(DRE.GetInt32(reader, "purchase_bill_id")) }; purchaseBills.Add(purchaseBill); } return(purchaseBills); }
/// <summary> /// /// </summary> /// <param name="addressTypeName"></param> /// <returns></returns> public Entities.AddressType GetAddressTypeByName(string addressTypeName) { var addressType = new Entities.AddressType(); DbCommand dbCommand = null; using (dbCommand = database.GetStoredProcCommand(DBStoredProcedure.GetAddressTypeDetailsByName)) { database.AddInParameter(dbCommand, "@address_type", DbType.String, addressTypeName); using (IDataReader reader = database.ExecuteReader(dbCommand)) { while (reader.Read()) { var _addressType = new Entities.AddressType { AddressTypeId = DRE.GetNullableInt32(reader, "address_type_id", 0), AddressTypeName = DRE.GetNullableString(reader, "address_type", null) }; addressType = _addressType; } } } return(addressType); }
/// <summary> /// Gets a role by id /// </summary> /// <param name="roleId">Specifies the id of a role.</param> /// <returns>An object representing the role</returns> public Entities.Role GetRoleDetailsById(Int32 roleId) { var role = new Entities.Role(); DbCommand dbCommand = null; using (dbCommand = database.GetStoredProcCommand(DBStoredProcedure.GetRoleDetailsById)) { database.AddInParameter(dbCommand, "@role_id", DbType.Int32, roleId); using (IDataReader reader = database.ExecuteReader(dbCommand)) { while (reader.Read()) { var _role = new Entities.Role { RoleId = DRE.GetNullableInt32(reader, "role_id", 0), RoleName = DRE.GetNullableString(reader, "role_name", null), RoleDesc = DRE.GetNullableString(reader, "role_desc", null) }; role = _role; } } } return(role); }
public List <Entities.Drug> GetDrugIdAndDrugNameByDrugName(string drugOrXRay, string drugName) { var drugs = new List <Entities.Drug>(); try { using (DbCommand dbCommand = database.GetStoredProcCommand(DBStoredProcedure.GetDrugIdAndDrugNameByDrugName)) { database.AddInParameter(dbCommand, "@drug_or_xray", DbType.String, drugOrXRay); database.AddInParameter(dbCommand, "@drug_name", DbType.String, drugName); using (IDataReader reader = database.ExecuteReader(dbCommand)) { while (reader.Read()) { var drug = new Entities.Drug { DrugId = DRE.GetNullableInt32(reader, "drug_id", 0), DrugName = DRE.GetNullableString(reader, "drug_name", null), DrugCode = DRE.GetNullableInt32(reader, "drug_code", null) }; drugs.Add(drug); } } } } catch (Exception ex) { throw ex; } return(drugs); }
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.XRayIssue> GetPastXRayIssueDatesByPatientId(Int32 patientId) { var xrayIssueDates = new List <Entities.XRayIssue>(); try { using (DbCommand dbCommand = database.GetStoredProcCommand(DBStoredProcedure.GetPastXRayIssuedDatesByPatientId)) { database.AddInParameter(dbCommand, "@patient_id", DbType.Int32, patientId); using (IDataReader reader = database.ExecuteReader(dbCommand)) { while (reader.Read()) { var xRayIssue = new Entities.XRayIssue() { XRayIssueId = DRE.GetNullableInt32(reader, "xray_issue_id", null), XRayIssueDate = DRE.GetNullableString(reader, "xray_issue_date", null) }; xrayIssueDates.Add(xRayIssue); } } } } catch (Exception e) { throw e; } return(xrayIssueDates); }
/// <summary> /// /// </summary> /// <param name="clientId"></param> /// <returns></returns> public Entities.Client GetClientById(Int32 clientId) { var client = new Entities.Client(); DbCommand dbCommand = null; using (dbCommand = database.GetStoredProcCommand(DBStoredProcedure.GetClientById)) { database.AddInParameter(dbCommand, "@client_id", DbType.Int32, clientId); using (IDataReader reader = database.ExecuteReader(dbCommand)) { while (reader.Read()) { var _client = new Entities.Client { ClientTypeId = DRE.GetNullableInt32(reader, "client_type_id", 0), ClientTypeName = DRE.GetNullableString(reader, "client_type", null), ClientId = DRE.GetNullableInt32(reader, "client_id", 0), ClientName = DRE.GetNullableString(reader, "client_name", null), PANNo = DRE.GetNullableString(reader, "pan_no", null) }; client = _client; } } } return(client); }
/// <summary> /// /// </summary> /// <param name="patientId"></param> /// <returns></returns> public List <Entities.PatientExerciseHistory> GetPatientExerciseHistoriesByPatientId(Int32 patientId) { List <Entities.PatientExerciseHistory> patientExercisesHistory = new List <Entities.PatientExerciseHistory>(); try { using (DbCommand dbCommand = database.GetStoredProcCommand(DBStoredProcedure.GetPatientExerciseDetailsByPatientId)) { database.AddInParameter(dbCommand, "@patient_id", DbType.Int32, patientId); using (IDataReader reader = database.ExecuteReader(dbCommand)) { while (reader.Read()) { Entities.PatientExerciseHistory patientExerciseHistory = new Entities.PatientExerciseHistory() { PatientExerciseHistoryId = DRE.GetNullableInt32(reader, "patient_exercise_history_id", 0), PatientId = DRE.GetNullableInt32(reader, "patient_id", 0), ExerciseName = DRE.GetNullableString(reader, "exercise_name", null), Frequency = DRE.GetNullableString(reader, "frequency", null), SrNo = DRE.GetNullableInt64(reader, "sr_no", null) }; patientExercisesHistory.Add(patientExerciseHistory); } } } } catch (Exception ex) { throw ex; } return(patientExercisesHistory); }
public Entities.PurchaseBillReturn GetPurchaseBillInfoByPurchaseBillId(Int32 purchaseBillId) { var purchaseBillInfo = new Entities.PurchaseBillReturn(); try { using (DbCommand dbCommand = database.GetStoredProcCommand(DBStoredProcedure.GetPurchaseBillInfoByPurchaseBillId)) { database.AddInParameter(dbCommand, "@purchase_bill_id", DbType.Int32, purchaseBillId); using (IDataReader reader = database.ExecuteReader(dbCommand)) { while (reader.Read()) { var purchaseBillReturn = new Entities.PurchaseBillReturn() { PurchaseBillId = DRE.GetNullableInt32(reader, "purchase_bill_id", 0), PurchaseBillNo = DRE.GetNullableString(reader, "purchase_bill_no", null), PurchaseBillDate = DRE.GetNullableString(reader, "purchase_bill_date", null), VendorName = DRE.GetNullableString(reader, "vendor_name", null) }; purchaseBillInfo = purchaseBillReturn; } } } } catch (Exception ex) { throw ex; } return(purchaseBillInfo); }
public List <Entities.BloodGroup> GetAllBloodGroups() { var bloodGroups = new List <Entities.BloodGroup>(); try { using (DbCommand dbCommand = database.GetStoredProcCommand(DBStoredProcedure.GetAllBloodGroups)) { using (IDataReader reader = database.ExecuteReader(dbCommand)) { while (reader.Read()) { var bloodGroup = new Entities.BloodGroup { BloodGroupId = DRE.GetNullableInt32(reader, "blood_group_id", 0), BloodGroupName = DRE.GetNullableString(reader, "blood_group", null), BloodGroupFactorId = DRE.GetNullableInt32(reader, "blood_group_factor_id", null) }; bloodGroups.Add(bloodGroup); } } } } catch (Exception ex) { throw ex; } return(bloodGroups); }
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); }
/// <summary> /// /// </summary> /// <returns></returns> public List <Entities.Company> SearchCompaniesByCompanyCodeOrName(string searchCriteria) { var companies = new List <Entities.Company>(); try { using (DbCommand dbCommand = database.GetStoredProcCommand(DBStoredProcedure.SearchCompaniesByCompanyCodeOrName)) { database.AddInParameter(dbCommand, "@search_company_name", DbType.String, searchCriteria); using (IDataReader reader = database.ExecuteReader(dbCommand)) { while (reader.Read()) { var company = new Entities.Company { CompanyId = DRE.GetNullableInt32(reader, "company_id", 0), CompanyName = DRE.GetNullableString(reader, "company_name", null) }; companies.Add(company); } } } } catch (Exception ex) { throw ex; } return(companies); }
public List <Entities.PurchaseBill> GetPurchaseBillIdAndPurcharseBillNo() { var purchaseBills = new List <Entities.PurchaseBill>(); try { using (DbCommand dbCommand = database.GetStoredProcCommand(DBStoredProcedure.GetPurchaseBillIdAndPurchaeBillNo)) { using (IDataReader reader = database.ExecuteReader(dbCommand)) { while (reader.Read()) { var purchaseBill = new Entities.PurchaseBill { PurchaseBillId = DRE.GetNullableInt32(reader, "purchase_bill_id", 0), PurchaseBillNo = DRE.GetNullableString(reader, "purchase_bill_no", null) }; purchaseBills.Add(purchaseBill); } } } } catch (Exception ex) { throw ex; } return(purchaseBills); }
public List <Entities.Company> GetCompanyIdAndCompanyName() { var companies = new List <Entities.Company>(); try { using (DbCommand dbCommand = database.GetStoredProcCommand(DBStoredProcedure.GetCompanyIdAndCompanyName)) { using (IDataReader reader = database.ExecuteReader(dbCommand)) { while (reader.Read()) { var company = new Entities.Company { CompanyId = DRE.GetNullableInt32(reader, "company_id", 0), CompanyName = DRE.GetNullableString(reader, "company_name", null) }; companies.Add(company); } } } } catch (Exception ex) { throw ex; } return(companies); }
public List <Entities.PreEmploymentTestDetails> GetPreEmploymentTestDetailsByPreEmploymentId(Int32 preEmploymentId) { var testDetails = new List <Entities.PreEmploymentTestDetails>(); using (DbCommand dbCommand = database.GetStoredProcCommand(DBStoredProcedure.GetPreEmploymentTestDetailsByPreEmploymentId)) { database.AddInParameter(dbCommand, "@pre_employment_id", DbType.Int32, preEmploymentId); using (IDataReader reader = database.ExecuteReader(dbCommand)) { while (reader.Read()) { var employmentTestDetails = new Entities.PreEmploymentTestDetails() { PreEmploymentTestId = DRE.GetNullableInt32(reader, "pre_employment_test_id", 0), PreEmploymentId = DRE.GetNullableInt32(reader, "pre_employment_id", 0), MedicalTestId = DRE.GetNullableInt32(reader, "medical_test_id", null), MedicalTestParameterId = DRE.GetNullableInt32(reader, "medical_test_parameter_id", null), TestName = DRE.GetNullableString(reader, "test_name", null), TestValue = DRE.GetNullableString(reader, "test_value", null), IsParameters = DRE.GetNullableBoolean(reader, "is_parameters", null), IsTestGeneral = DRE.GetNullableBoolean(reader, "is_test_general", null) }; testDetails.Add(employmentTestDetails); } } } return(testDetails); }
/// <summary> /// /// </summary> /// <returns></returns> public List <Entities.Brand> GetAllBrands() { var brands = new List <Entities.Brand>(); try { using (DbCommand dbCommand = database.GetStoredProcCommand(DBStoredProcedure.GetListOfAllBrands)) { using (IDataReader reader = database.ExecuteReader(dbCommand)) { while (reader.Read()) { var brand = new Entities.Brand { BrandId = DRE.GetNullableInt32(reader, "brand_id", 0), BrandName = DRE.GetNullableString(reader, "brand_name", null), guid = DRE.GetNullableGuid(reader, "row_guid", null), SrNo = DRE.GetNullableInt64(reader, "sr_no", null) }; brands.Add(brand); } } } } catch (Exception ex) { throw ex; } return(brands); }
public List <Entities.DrugFormulation> GetDrugFormulationIdAndCode() { var drugFormulations = new List <Entities.DrugFormulation>(); try { using (DbCommand dbCommand = database.GetStoredProcCommand(DBStoredProcedure.GetDrugFormulationIdAndCode)) { using (IDataReader reader = database.ExecuteReader(dbCommand)) { while (reader.Read()) { var drugFormulation = new Entities.DrugFormulation() { DrugFormulationId = DRE.GetNullableInt32(reader, "drug_formulation_id", 0), DrugFormulationCode = DRE.GetNullableString(reader, "drug_formulation_code", null) }; drugFormulations.Add(drugFormulation); } } } } catch (Exception ex) { throw ex; } return(drugFormulations); }
/// <summary> /// /// </summary> /// <param name="brandName"></param> /// <returns></returns> public Entities.Brand GetBrandDetailsByName(string brandName) { var brand = new Entities.Brand(); using (DbCommand dbCommand = database.GetStoredProcCommand(DBStoredProcedure.GetBrandDetailsByName)) { database.AddInParameter(dbCommand, "@brand_name", DbType.String, brandName); using (IDataReader reader = database.ExecuteReader(dbCommand)) { while (reader.Read()) { var _brand = new Entities.Brand { BrandId = DRE.GetNullableInt32(reader, "brand_id", 0), BrandName = DRE.GetNullableString(reader, "brand_name", null), guid = DRE.GetNullableGuid(reader, "row_guid", null) }; brand = _brand; } } } return(brand); }
/// <summary> /// /// </summary> /// <param name="drugGroupName"></param> /// <returns></returns> public Entities.DrugGroup GetDrugGroupDetailsByName(string drugGroupName) { var drugGroupDetails = new Entities.DrugGroup(); using (DbCommand dbCommand = database.GetStoredProcCommand(DBStoredProcedure.GetDetailsOfDrugGroupByName)) { database.AddInParameter(dbCommand, "@DrugGroup_name", DbType.String, drugGroupName); using (IDataReader reader = database.ExecuteReader(dbCommand)) { while (reader.Read()) { var drugGruop = new Entities.DrugGroup { DrugGroupId = DRE.GetNullableInt32(reader, "drug_group_id", 0), GroupName = DRE.GetNullableString(reader, "group_name", null) }; drugGroupDetails = drugGruop; } } } return(drugGroupDetails); }
public List <Entities.DrugLinkWithDrugRoutes> GetDrugLinkByDrugId(Int32?drugId = null) { var drugsLink = new List <Entities.DrugLinkWithDrugRoutes>(); try { using (DbCommand dbCommand = database.GetStoredProcCommand(DBStoredProcedure.GetDrugLinkByDrugId)) { database.AddInParameter(dbCommand, "@drug_id", DbType.Int32, drugId); using (IDataReader reader = database.ExecuteReader(dbCommand)) { while (reader.Read()) { var drugLink = new Entities.DrugLinkWithDrugRoutes { DrugRouteLinkId = DRE.GetNullableInt32(reader, "drug_route_link_id", null), DrugId = DRE.GetNullableInt32(reader, "drug_id", 0), DrugRouteId = DRE.GetNullableInt32(reader, "drug_route_id", null), RouteName = DRE.GetNullableString(reader, "route_name", null) }; drugsLink.Add(drugLink); } } } } catch (Exception ex) { throw ex; } return(drugsLink); }
public List <Entities.DrugDispenseReturn> GetPastDrugReturnDatesByPatientId(Int32 patientId) { var drugDispenseDates = new List <Entities.DrugDispenseReturn>(); try { using (DbCommand dbCommand = database.GetStoredProcCommand(DBStoredProcedure.GetPastDrugDispenseDatesByPatientId)) { database.AddInParameter(dbCommand, "@patient_id", DbType.Int32, patientId); using (IDataReader reader = database.ExecuteReader(dbCommand)) { while (reader.Read()) { var drugDispenseDate = new Entities.DrugDispenseReturn() { DrugDispenseReturnId = DRE.GetNullableInt32(reader, "drug_dispense_return_id", null), DrugReturnDate = DRE.GetNullableString(reader, "drug_return_date", null) }; drugDispenseDates.Add(drugDispenseDate); } } } } catch (Exception e) { throw e; } return(drugDispenseDates); }
/// <summary> /// /// </summary> /// <param name="clientTypeName"></param> /// <returns></returns> public Entities.ClientType GetClientTypeByName(string clientTypeName) { var clientType = new Entities.ClientType(); DbCommand dbCommand = null; using (dbCommand = database.GetStoredProcCommand(DBStoredProcedure.GetClientTypeByName)) { database.AddInParameter(dbCommand, "@client_type", DbType.String, clientTypeName); using (IDataReader reader = database.ExecuteReader(dbCommand)) { while (reader.Read()) { var _clientType = new Entities.ClientType { ClientTypeId = DRE.GetNullableInt32(reader, "client_type_id", 0), ClientTypeName = DRE.GetNullableString(reader, "client_type", null) }; clientType = _clientType; } } } return(clientType); }
public List <Entities.DrugRoutes> SearchDrugRoutesByRouteName(string routeName) { var drugRoutes = new List <Entities.DrugRoutes>(); try { using (DbCommand dbCommand = database.GetStoredProcCommand(DBStoredProcedure.GetAllDrugRouteIdAndRouteName)) { database.AddInParameter(dbCommand, "@route_name", DbType.String, routeName); using (IDataReader reader = database.ExecuteReader(dbCommand)) { while (reader.Read()) { var drugRoute = new Entities.DrugRoutes { DrugRouteId = DRE.GetNullableInt32(reader, "drug_route_id", 0), RouteName = DRE.GetNullableString(reader, "route_name", null) }; drugRoutes.Add(drugRoute); } } } } catch (Exception ex) { throw ex; } return(drugRoutes); }
public List <Entities.Employer> GetEmployerIdAndNameByName(string employerName) { var employers = new List <Entities.Employer>(); try { using (DbCommand dbCommand = database.GetStoredProcCommand(DBStoredProcedure.GetEmployerIdAndNameByName)) { database.AddInParameter(dbCommand, "@employer_name", DbType.String, employerName); using (IDataReader reader = database.ExecuteReader(dbCommand)) { while (reader.Read()) { var employer = new Entities.Employer { EmployerId = DRE.GetNullableInt32(reader, "employer_id", 0), EmployerName = DRE.GetNullableString(reader, "employer_name", null) }; employers.Add(employer); } } } } catch (Exception ex) { throw ex; } return(employers); }