예제 #1
0
        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;
                }
            }
        }
예제 #2
0
 public void UpdatePKCK(DTO_PKChuyenKhoa pkck)
 {
     using (var context = new SQLServerDBContext())
     {
         context.Entry(pkck).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
예제 #3
0
 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);
     }
 }
예제 #4
0
 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);
     }
 }
예제 #5
0
        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;
            }
        }
예제 #6
0
 public void LoadNPBacSi(DTO_PKChuyenKhoa pKChuyenKhoa)
 {
     DALManager.PKChuyenKhoaDAL.LoadNPBacSi(pKChuyenKhoa);
 }
예제 #7
0
 public void UpdatePKCK(DTO_PKChuyenKhoa pkck)
 {
     DALManager.PKChuyenKhoaDAL.UpdatePKCK(pkck);
 }
예제 #8
0
 public void LoadNPKetQua(DTO_PKChuyenKhoa pKChuyenKhoa)
 {
     DALManager.PKChuyenKhoaDAL.LoadNPKetQua(pKChuyenKhoa);
 }
예제 #9
0
 public void LoadNPYeuCau(DTO_PKChuyenKhoa pKChuyenKhoa)
 {
     DALManager.PKChuyenKhoaDAL.LoadNPYeuCau(pKChuyenKhoa);
 }