Ejemplo n.º 1
0
 public void AddCTPhieuNhapThuoc(DTO_CTPhieuNhapThuoc ctPhieuNhapThuoc)
 {
     using (var context = new SQLServerDBContext())
     {
         context.CTPhieuNhapThuoc.Add(ctPhieuNhapThuoc);
         context.SaveChanges();
     }
 }
Ejemplo n.º 2
0
 public void UpdatePKDK(DTO_PKDaKhoa pkdk)
 {
     using (var context = new SQLServerDBContext())
     {
         context.Entry(pkdk).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
Ejemplo n.º 3
0
 public void AddBCDoanhThu(DTO_BCDoanhThu bCDoanhThu)
 {
     using (var context = new SQLServerDBContext())
     {
         context.BaoCaoDoanhThu.Add(bCDoanhThu);
         context.SaveChanges();
     }
 }
Ejemplo n.º 4
0
 public void UpdateBCDoanhThu(DTO_BCDoanhThu bc)
 {
     using (var context = new SQLServerDBContext())
     {
         context.Entry(bc).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
Ejemplo n.º 5
0
 public void UpdateCTBaoCaoDoanhThu(DTO_CTBaoCaoDoanhThu cTBaoCaoDoanhThu)
 {
     using (var context = new SQLServerDBContext())
     {
         context.Entry(cTBaoCaoDoanhThu).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
Ejemplo n.º 6
0
 public void AddCTHDThuoc(DTO_CTHDThuoc cTHDThuoc)
 {
     using (var context = new SQLServerDBContext())
     {
         context.CTHoaDdonThuoc.Add(cTHDThuoc);
         context.SaveChanges();
     }
 }
Ejemplo n.º 7
0
 public void AddCTBaoCaoDoanhThu(DTO_CTBaoCaoDoanhThu cTBaoCaoDoanhThu)
 {
     using (var context = new SQLServerDBContext())
     {
         context.CT_BaoCaoDoanhThu.Add(cTBaoCaoDoanhThu);
         context.SaveChanges();
     }
 }
Ejemplo n.º 8
0
 public void AddBCSuDungThuoc(DTO_BCSudungThuoc bCSudungThuoc)
 {
     using (var context = new SQLServerDBContext())
     {
         context.BaoCaoSuDungThuoc.Add(bCSudungThuoc);
         context.SaveChanges();
     }
 }
Ejemplo n.º 9
0
        public void SuDungThuoc(string maThuoc, int soLuongDung)
        {
            using (var context = new SQLServerDBContext())
            {
                var res = context.Thuoc.Where(t => t.MaThuoc == maThuoc).FirstOrDefault();

                if (res != null)
                {
                    res.SoLuong -= soLuongDung;
                }

                context.SaveChanges();
            }
        }
Ejemplo n.º 10
0
        public void CapNhatBCSDThuoc(string maThuoc, DateTime ngaySuDung, int soLuongDung)
        {
            using (var context = new SQLServerDBContext())
            {
                var res = context.BaoCaoSuDungThuoc.Where(t => (t.MaThuoc == maThuoc) && (t.Thang == ngaySuDung.Month) && (t.Nam == ngaySuDung.Year)).FirstOrDefault();

                if (res != null)
                {
                    res.SoLanDung++;
                    res.SoLuongDung += soLuongDung;
                }

                context.SaveChanges();
            }
        }
Ejemplo n.º 11
0
 public bool UpdateInfo(DTO_BenhNhan bn)
 {
     using (var context = new SQLServerDBContext())
     {
         try
         {
             context.Entry(bn).State = EntityState.Modified;
             context.SaveChanges();
             return(true);
         }
         catch (Exception e)
         {
             throw e;
         }
     }
 }
Ejemplo n.º 12
0
        public bool UpdateInfoAcc(DTO_Account acc, string username, string password)
        {
            using (var context = new SQLServerDBContext())
            {
                var res = context.Account.FirstOrDefault(a => a.Username == acc.Username);
                if (res != null)
                {
                    res.Username = username;
                    res.Password = password;

                    context.SaveChanges();

                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 13
0
 public void UpdateThamSo(List <DTO_ThamSo> thamSo)
 {
     using (var context = new SQLServerDBContext())
     {
         try
         {
             foreach (var ts in thamSo)
             {
                 context.Entry(ts).State = EntityState.Modified;
             }
             context.SaveChanges();
         }
         catch (Exception e)
         {
             throw e;
         }
     }
 }
Ejemplo n.º 14
0
        public bool UpdateInfoNV(DTO_NhanVien nv, string ten, DateTime ngaySinh, bool gioiTinh, string email, string diaChi, string sdt, string soCMND, string maNhom, string maPhong)
        {
            using (var context = new SQLServerDBContext())
            {
                var res = context.NhanVien.FirstOrDefault(n => n.MaNhanVien == nv.MaNhanVien);
                if (res != null)
                {
                    res.HoTen       = ten;
                    res.NgaySinh    = ngaySinh;
                    res.GioiTinh    = gioiTinh;
                    res.Email       = email;
                    res.DiaChi      = diaChi;
                    res.SoDienThoai = sdt;
                    res.SoCMND      = soCMND;
                    res.MaNhom      = maNhom;
                    res.MaPhong     = maPhong;

                    context.SaveChanges();

                    return(true);
                }
            }
            return(false);
        }