public int CreateDiagnosis(DiagnosisModel model) { var repo = new DiagnosisRepository(); var dataModel = new HealthInformationProgram.Data.Tables.lkup_diag(); dataModel.diag_id = Convert.ToDecimal(model.DiagnosisId); dataModel.diag_descn = model.DiagnosisDescription; dataModel.diag_stat = model.DiagnosisStatus; dataModel.diag_abrvn = model.DiagnosisAbbreviation; dataModel.icd_cd = model.IcdCode; dataModel.user_intrfc_sort_ord = Convert.ToDecimal(model.SortOrder); dataModel.diag_strt_eff_dt = Convert.ToDateTime(model.DiagnosisEffectiveStartDate); dataModel.diag_end_eff_dt = Convert.ToDateTime(model.DiagnosisEffectiveEndDate); dataModel.rec_creat_dt = DateTime.Now; dataModel.rec_creat_user_id_cd = model.CreatedBy; dataModel.rec_updt_dt = DateTime.Now; dataModel.rec_updt_user_id_cd = model.UpdatedBy; try { var returnCode = repo.CreateDiagnosis(dataModel); return returnCode; } catch (Exception ex) { throw ex; } }
public void Can_GetAllDiagnosis() { var repo = new DiagnosisRepository(); var diagnosisList = repo.GetAll(); Assert.IsNotNull(diagnosisList); Assert.IsTrue(diagnosisList.Count > 0); }
public void Can_CreateDiagnosis() { var model = new HealthInformationProgram.Data.Tables.lkup_diag(); var repo = new DiagnosisRepository(); model.diag_abrvn = "tnd"; model.diag_descn = "test new description 2"; model.diag_stat = "A"; model.diag_strt_eff_dt = new DateTime(2015, 11, 30); model.diag_end_eff_dt = new DateTime(2016, 12, 01); model.rec_creat_dt = DateTime.Now; model.rec_creat_user_id_cd = "test user"; model.rec_updt_dt = DateTime.Now; model.rec_updt_user_id_cd = "test user"; var result = repo.CreateDiagnosis(model); Assert.AreEqual(1,result, "Not right number of records affected"); }
public DiagnosisModel GetDiagnosis(decimal id) { var repo = new DiagnosisRepository(); var item = repo.GetDiagnosis(id); var diagView = new DiagnosisModel(); diagView.DiagnosisId = GetDataValue(item.diag_id); diagView.DiagnosisStatus = GetDataValue(item.diag_stat); diagView.DiagnosisAbbreviation = GetDataValue(item.diag_abrvn); diagView.DiagnosisDescription = GetDataValue(item.diag_descn); diagView.SortOrder = GetDataValue(item.user_intrfc_sort_ord); diagView.IcdCode = GetDataValue(item.icd_cd); diagView.DiagnosisEffectiveStartDate = GetDataValue(item.diag_strt_eff_dt); diagView.DiagnosisEffectiveEndDate = GetDataValue(item.diag_end_eff_dt); diagView.CreateDate = GetDataValue(item.rec_creat_dt); diagView.CreatedBy = GetDataValue(item.rec_creat_user_id_cd); diagView.UpdateDate = GetDataValue(item.rec_updt_dt); diagView.UpdatedBy = GetDataValue(item.rec_updt_user_id_cd); return diagView; }
public DiagnosisModel GetDiagnosis(string id) { var repo = new DiagnosisRepository(); var item = repo.GetDiagnosis(Convert.ToDecimal(id)); var diagView = new DiagnosisModel(); diagView.DiagnosisId = item.diag_id.ToString(); diagView.DiagnosisStatus = item.diag_stat.ToString(); diagView.DiagnosisAbbreviation = item.diag_abrvn.ToString(); diagView.SortOrder = item.user_intrfc_sort_ord.ToString(); diagView.IcdCode = item.icd_cd.ToString(); diagView.DiagnosisEffectiveStartDate = item.diag_strt_eff_dt.ToString(); diagView.DiagnosisEffectiveEndDate = item.diag_end_eff_dt.ToString(); diagView.CreateDate = item.rec_creat_dt.ToString(); diagView.CreatedBy = item.rec_creat_user_id_cd.ToString(); diagView.UpdateDate = item.rec_updt_dt.ToString(); diagView.UpdatedBy = item.rec_updt_user_id_cd.ToString(); return diagView; }
public List<DiagnosisModel> GetAllDiagnosis() { var diagnosisList = new List<DiagnosisModel>(); var repo = new HealthInformationProgram.Data.Repositories.DiagnosisRepository(); try { var dataList = repo.GetAll(); foreach (var item in dataList) { var diagView = new DiagnosisModel(); diagView.DiagnosisId = GetDataValue(item.diag_id); diagView.DiagnosisDescription = GetDataValue(item.diag_descn); diagView.DiagnosisStatus = GetDataValue(item.diag_stat); diagView.DiagnosisAbbreviation = GetDataValue(item.diag_abrvn); diagView.IcdCode = GetDataValue(item.icd_cd); diagView.SortOrder = GetDataValue(item.user_intrfc_sort_ord); diagView.DiagnosisEffectiveStartDate = item.diag_strt_eff_dt.ToString(); diagView.DiagnosisEffectiveEndDate = item.diag_end_eff_dt.ToString(); diagView.CreateDate = item.rec_creat_dt.ToString(); diagView.CreatedBy = GetDataValue(item.rec_creat_user_id_cd); diagView.UpdateDate = item.rec_updt_dt.ToString(); diagView.UpdatedBy = GetDataValue(item.rec_updt_user_id_cd); diagnosisList.Add(diagView); } } catch (Exception ex) { throw ex; } return diagnosisList; }