public int Update(curr_sys_info entity) { try { using ( var ctx = new ClinicDataContext(connString) ) { var currentSystem = ctx.curr_sys_info.FirstOrDefault(x => x.curr_sys_id == entity.curr_sys_id); if ( currentSystem == null ) { throw new Exception("Record doesn't exist and cannot be updated"); } currentSystem.curr_sys_id = entity.curr_sys_id; currentSystem.itm_vrsn = entity.itm_vrsn; currentSystem.itm_descn = entity.itm_descn; currentSystem.dt_of_rlse = entity.dt_of_rlse; ctx.Entry(currentSystem).State = System.Data.Entity.EntityState.Modified; int result = ctx.SaveChanges(); return result; } } catch ( Exception ex ) { throw ex; } }
public int CreateFacility(lkup_faclty entity) { try { using ( var ctx = new ClinicDataContext(connString) ) { IdentityInsertOn<lkup_faclty>(ctx, entity); ctx.Entry(entity).State = System.Data.Entity.EntityState.Added; int result = ctx.SaveChanges(); return result; } } catch ( DbEntityValidationException ex ) { throw ex; } catch ( EntityException ex ) { throw ex; } catch ( Exception ex ) { throw ex; } }
public int Update(ov_diag entity) { try { using ( var ctx = new ClinicDataContext(connString) ) { var officeVisitDiagnonsis = ctx.ov_diag.FirstOrDefault(x => x.ov_diag_id == entity.ov_diag_id); if (officeVisitDiagnonsis == null ) { throw new Exception("Record doesn't exist and cannot be updated"); } officeVisitDiagnonsis.ov_diag_id = entity.ov_diag_id; officeVisitDiagnonsis.ov_id = entity.ov_id; officeVisitDiagnonsis.splmtl_diag_id = entity.splmtl_diag_id; officeVisitDiagnonsis.diag_id = entity.diag_id; officeVisitDiagnonsis.cntct_trmnt_cnt = entity.cntct_trmnt_cnt; officeVisitDiagnonsis.splmtl_diag_cat_id = entity.splmtl_diag_cat_id; officeVisitDiagnonsis.oth_diag_descn = entity.oth_diag_descn; officeVisitDiagnonsis.oth_splmtl_diag_descn = entity.oth_splmtl_diag_descn; officeVisitDiagnonsis.rec_updt_dt = entity.rec_updt_dt; officeVisitDiagnonsis.rec_updt_user_id_cd = entity.rec_updt_user_id_cd; ctx.Entry(officeVisitDiagnonsis).State = System.Data.Entity.EntityState.Modified; int result = ctx.SaveChanges(); return result; } } catch ( Exception ex ) { throw ex; } }
public int Update(lkup_bnfcry entity) { try { using ( var ctx = new ClinicDataContext(connString) ) { var lookupBeneficiary = ctx.lkup_bnfcry.FirstOrDefault(x => x.bnfcry_id == entity.bnfcry_id); if (lookupBeneficiary == null ) { throw new Exception("Record doesn't exist and cannot be updated"); } lookupBeneficiary.bnfcry_id = entity.bnfcry_id; lookupBeneficiary.rec_updt_dt = entity.rec_updt_dt; lookupBeneficiary.rec_updt_user_id_cd = entity.rec_updt_user_id_cd; ctx.Entry(lookupBeneficiary).State = System.Data.Entity.EntityState.Modified; int result = ctx.SaveChanges(); return result; } } catch ( Exception ex ) { throw ex; } }
public int CreateSupplementalDiagnosisCat(lkup_splmtl_diag_cat entity) { try { using ( var ctx = new ClinicDataContext(connString) ) { IdentityInsertOn<lkup_splmtl_diag_cat>(ctx, entity); ctx.Entry(entity).State = System.Data.Entity.EntityState.Added; int result = ctx.SaveChanges(); return result; } } catch ( DbEntityValidationException ex ) { throw ex; } catch ( EntityException ex ) { throw ex; } catch ( Exception ex ) { throw ex; } }
public int Update(raw_visit entity) { try { using ( var ctx = new ClinicDataContext(connString) ) { var rawVisit = ctx.raw_visit.FirstOrDefault(x => x.visit_uuid == entity.visit_uuid); if ( rawVisit == null ) { throw new Exception("Record doesn't exist and cannot be updated"); } rawVisit.visit_uuid = entity.visit_uuid; rawVisit.visit_stat = entity.visit_stat; rawVisit.visit_json = entity.visit_json; rawVisit.err_cd = entity.err_cd; rawVisit.rec_updt_user_id_cd = entity.rec_updt_user_id_cd; rawVisit.rec_updt_dt = entity.rec_updt_dt; ctx.Entry(rawVisit).State = System.Data.Entity.EntityState.Modified; int result = ctx.SaveChanges(); return result; } } catch ( Exception ex ) { throw ex; } }
public List<Catalog> GetAllReports() { var reportList = new List<Catalog>(); using (var ctx = new ClinicDataContext(connString)) { reportList= ctx.Catalog.ToList(); } return reportList; }
public ov GetOfficeVisit(decimal id) { try { using ( var ctx = new ClinicDataContext(connString) ) { return ctx.ovs.Where(v => v.ov_id == id).FirstOrDefault(); } } catch ( Exception ex ) { throw ex; } }
public lkup_rvisit GetRevisit(decimal id) { try { using ( var ctx = new ClinicDataContext(connString) ) { return ctx.lkup_rvisit.Where(v=>v.rvisit_id == id).FirstOrDefault(); } } catch ( Exception ex ) { throw ex; } }
public lkup_diag GetDiagnosis(decimal id) { try { using (var ctx = new ClinicDataContext(connString)) { return ctx.lkup_diag.Where(v => v.diag_id == id).FirstOrDefault(); } } catch (Exception ex) { throw ex; } }
public curr_sys_info GetCurrentSystemInfo(decimal id) { try { using ( var ctx = new ClinicDataContext(connString) ) { return ctx.curr_sys_info.Where(v => v.curr_sys_id == id).FirstOrDefault(); } } catch ( Exception ex ) { throw ex; } }
public List<curr_sys_info> GetAll() { try { using ( var ctx = new ClinicDataContext(connString) ) { return ctx.curr_sys_info.ToList(); } } catch ( Exception ex ) { throw ex; } }
public lkup_gndr GetGender(decimal id) { try { using ( var ctx = new ClinicDataContext(connString) ) { return ctx.lkup_gndr.Where(v=>v.gndr_id == id).FirstOrDefault(); } } catch ( Exception ex ) { throw ex; } }
public lkup_exceptions GetException(decimal id) { try { using ( var ctx = new ClinicDataContext(connString) ) { return ctx.lkup_exceptions.Where(v => v.err_cd == id).FirstOrDefault(); } } catch ( Exception ex ) { throw ex; } }
public List<faclty_hw_invtry> GetAll() { try { using ( var ctx = new ClinicDataContext(connString) ) { return ctx.faclty_hw_invtry.ToList(); } } catch ( Exception ex ) { throw ex; } }
public List<ov_diag> GetDiagnosisByVisitId(decimal officeVisitId) { try { using (var ctx = new ClinicDataContext(connString)) { return ctx.ov_diag.Where(v => v.ov_id == officeVisitId).ToList(); } } catch (Exception ex) { throw ex; } }
public raw_visit GetRawVisit(string id) { try { using ( var ctx = new ClinicDataContext(connString) ) { return ctx.raw_visit.Where(v => v.visit_uuid == id).FirstOrDefault(); } } catch ( Exception ex ) { throw ex; } }
public faclty_hw_invtry GetFacilityHardwareByFacility(decimal facilityId) { try { using ( var ctx = new ClinicDataContext(connString) ) { return ctx.faclty_hw_invtry.Where(f => f.faclty_id == facilityId).FirstOrDefault(); } } catch ( Exception ex ) { throw ex; } }
public curr_sys_info GetCurrentSystemVersion() { try { using ( var ctx = new ClinicDataContext(connString) ) { return ctx.curr_sys_info.OrderByDescending(c=>c.dt_of_rlse).FirstOrDefault(); } } catch ( Exception ex ) { throw ex; } }
public lkup_splmtl_diag_cat GetSupplementalDiagnosisCat(string category) { try { using ( var ctx = new ClinicDataContext(connString) ) { return ctx.lkup_splmtl_diag_cat.Where(v => v.splmtl_diag_cat == category).FirstOrDefault(); } } catch ( Exception ex ) { throw ex; } }
public List<lkup_splmtl_diag> GetAllSupplementalDiagnosisForGivenDiagnosisId(decimal diagnosisId) { try { using (var ctx = new ClinicDataContext(connString)) { return ctx.lkup_splmtl_diag.Where(x => x.diag_id == diagnosisId).ToList(); ; } } catch (Exception ex) { throw ex; } }
public List<ov> GetAll() { try { using ( var ctx = new ClinicDataContext(connString) ) { return ctx.ovs.ToList(); } } catch ( Exception ex ) { throw ex; } }
public List<lkup_splmtl_diag_cat> GetAll() { try { using ( var ctx = new ClinicDataContext(connString) ) { return ctx.lkup_splmtl_diag_cat.OrderBy(x => x.user_intrfc_sort_ord).ToList(); } } catch ( Exception ex ) { throw ex; } }
public lkup_faclty GetFacilityByOrganization(decimal id) { try { using ( var ctx = new ClinicDataContext(connString) ) { return ctx.lkup_faclty.Where(v => v.orgzn_id == id).FirstOrDefault(); } } catch ( Exception ex ) { throw ex; } }
public lkup_bnfcry GetBeneficiaryType(decimal id) { try { using ( var ctx = new ClinicDataContext(connString) ) { return ctx.lkup_bnfcry.Where(v=>v.bnfcry_id == id).FirstOrDefault(); } } catch ( Exception ex ) { throw ex; } }
public decimal CreateOfficeDiagnosis(ov_diag entity) { try { using ( var ctx = new ClinicDataContext(connString) ) { ctx.ov_diag.Add(entity); int result = ctx.SaveChanges(); return entity.ov_id; } } catch ( Exception ex ) { throw ex; } }
public int CreateRevisitConstant(lkup_rvisit entity) { try { using ( var ctx = new ClinicDataContext(connString) ) { ctx.lkup_rvisit.Add(entity); int result = ctx.SaveChanges(); return result; } } catch ( Exception ex ) { throw ex; } }
public int CreateGender(lkup_gndr entity) { try { using ( var ctx = new ClinicDataContext(connString) ) { ctx.lkup_gndr.Add(entity); int result = ctx.SaveChanges(); return result; } } catch ( Exception ex ) { throw ex; } }
public int CreateCurrentSystemInfo(curr_sys_info entity) { try { using ( var ctx = new ClinicDataContext(connString) ) { ctx.curr_sys_info.Add(entity); int result = ctx.SaveChanges(); return result; } } catch ( Exception ex ) { throw ex; } }
public int CreateBeneficiaryType(lkup_bnfcry entity) { try { using ( var ctx = new ClinicDataContext(connString) ) { ctx.lkup_bnfcry.Add(entity); int result = ctx.SaveChanges(); return result; } } catch ( Exception ex ) { throw ex; } }