public async Task <List <string> > AddPhieuKhamChuyenKhoaAsync(DTO_PKChuyenKhoa pKChuyenKhoa) { using (var context = new SQLServerDBContext()) { var returnCode = new SqlParameter(); returnCode.ParameterName = "@ReturnCode"; returnCode.SqlDbType = SqlDbType.Int; returnCode.Direction = ParameterDirection.Output; string res = null; try { res = await context.Database.SqlQuery <string>("exec @ReturnCode = proc_PKCK_insert @1, @2, @3, @4", new SqlParameter[] { new SqlParameter("@1", pKChuyenKhoa.NgayKham), new SqlParameter("@2", pKChuyenKhoa.YeuCau), new SqlParameter("@3", pKChuyenKhoa.MaNhanVien), new SqlParameter("@4", pKChuyenKhoa.PhieuKhamDaKhoa.MaPKDK), returnCode }).FirstOrDefaultAsync(); var code = ((int)returnCode.Value).ToString(); return(new List <string> { code, res }); } catch (Exception e) { Debug.WriteLine("[ERROR ADD PKCK] " + e.Message); throw e; } } }
public void UpdatePKCK(DTO_PKChuyenKhoa pkck) { using (var context = new SQLServerDBContext()) { context.Entry(pkck).State = EntityState.Modified; context.SaveChanges(); } }
public bool LoadNPPKDaKhoa(DTO_PKChuyenKhoa pKChuyenKhoa) { try { using (var context = new SQLServerDBContext()) { context.PKChuyenKhoa.Attach(pKChuyenKhoa); var entry = context.Entry(pKChuyenKhoa); entry.Reference(p => p.PhieuKhamDaKhoa).Load(); return(true); } } catch (Exception e) { Debug.WriteLine($"[ERRROR DAL_PKCHUYENKHOA] {e.Message}"); return(false); } }
public bool LoadNPKetQua(DTO_PKChuyenKhoa pKChuyenKhoa) { try { using (var context = new SQLServerDBContext()) { context.PKChuyenKhoa.Attach(pKChuyenKhoa); var entry = context.Entry(pKChuyenKhoa); if (!entry.Reference(p => p.KetQua).IsLoaded) { entry.Reference(p => p.KetQua).Load(); } return(true); } } catch (Exception e) { Debug.WriteLine($"[ERRROR DAL_PKDAKHOA] {e.Message}"); return(false); } }
public async Task <string> AddPhieuKhamChuyenKhoaAsync(DTO_PKChuyenKhoa pKChuyenKhoa) { try { var res = await DALManager.PKChuyenKhoaDAL.AddPhieuKhamChuyenKhoaAsync(pKChuyenKhoa); if (res.Count == 2) { var code = Convert.ToInt32(res[0]); if (code == SUCCESS_CODE) { return(res[1]); } } throw new Exception("Đã có lỗi xảy ra. Vui lòng thực hiện lại."); } catch (Exception e) { throw e; } }
public void LoadNPBacSi(DTO_PKChuyenKhoa pKChuyenKhoa) { DALManager.PKChuyenKhoaDAL.LoadNPBacSi(pKChuyenKhoa); }
public void UpdatePKCK(DTO_PKChuyenKhoa pkck) { DALManager.PKChuyenKhoaDAL.UpdatePKCK(pkck); }
public void LoadNPKetQua(DTO_PKChuyenKhoa pKChuyenKhoa) { DALManager.PKChuyenKhoaDAL.LoadNPKetQua(pKChuyenKhoa); }
public void LoadNPYeuCau(DTO_PKChuyenKhoa pKChuyenKhoa) { DALManager.PKChuyenKhoaDAL.LoadNPYeuCau(pKChuyenKhoa); }