CreateDiagnosis() public method

public CreateDiagnosis ( lkup_diag entity ) : int
entity HealthInformationProgram.Data.Tables.lkup_diag
return int
コード例 #1
0
        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;
            }
        }
コード例 #2
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");
        }