예제 #1
0
 public static List<cBenhnhanDO> Getdsbenhnhan(string NGAYHIENTAI)
 {
     List<cBenhnhanDO> dsbenhan = new List<cBenhnhanDO>();
     using (DB_HMS_Entities ds = new DB_HMS_Entities())
     {
         var query = from ads in ds.tbBENHNHANs
                     where ads.STT.Substring(0,5) == NGAYHIENTAI
                     select ads;
         foreach (var row in query)
         {
             cBenhnhanDO dss = new cBenhnhanDO();
             dss.MABENHNHAN = row.MABENHNHAN;
             dss.STT = row.STT;
             dss.TEN = row.TEN;
             dss.HO = row.HO;
             dss.HOTEN = row.HO + "" + row.TEN;
             dss.NGAYSINH = row.NGAYSINH;
             dss.TUOI = row.TUOI;
             dss.TRANGTHAI = row.TRANGTHAI.Value;
             dss.NGAYTAO = row.NGAYTAO.Value;
             dsbenhan.Add(dss);
         }
         return dsbenhan;
     }
 }
예제 #2
0
 public static List<cBenhanDO> Getdsbenhan2(string MABACSI, string MABENHNHAN, int MAXACNHAN)
 {
     List<cBenhanDO> dsbenhan = new List<cBenhanDO>();
     using (DB_HMS_Entities ds = new DB_HMS_Entities())
     {
         var query = from ads in ds.tbHOSOKHAMBENHs
                     join ads1 in ds.tbBENHNHANs on ads.MABENHNHAN equals ads1.MABENHNHAN
                     where ads.MAKHAMBENH == MABENHNHAN && ads.MAXACNHAN == MAXACNHAN && ads.MABACSY == MABACSI
                     select new { ads, ads1 };
         foreach (var row in query)
         {
             cBenhanDO dss = new cBenhanDO();
             dss.MABENHAN = row.ads.MAKHAMBENH;
             dss.MABENHNHAN = row.ads.MABENHNHAN;
             dss.MABACSY = row.ads.MABACSY;
             dss.HOTEN = row.ads1.HO + " " + row.ads1.TEN;
             dss.TUOI = row.ads.TUOI.ToString();
             dss.GIOITINH = row.ads.GIOITINH;
             dss.NGAYDK = row.ads.NGAYDK.Value;
             dss.GIODK = row.ads.GIODK.Value.ToString().Substring(9);
             dsbenhan.Add(dss);
         }
         return dsbenhan;
     }
 }
예제 #3
0
 public static List<cDonThuocMauChiTietDO> Getdsdonthuocmau(string MADONTHUOCMAU, string MABACSY)
 {
     List<cDonThuocMauChiTietDO> dsbenhan = new List<cDonThuocMauChiTietDO>();
     using (DB_HMS_Entities ds = new DB_HMS_Entities())
     {
         var query = from ads in ds.tbDONTHUOCMAUs
                     join ads1 in ds.tbDONTHUOCMAUCHITIETs on ads.MADONTHUOCMAU equals ads1.MADONTHUOCMAU
                     join ads2 in ds.tbTHUOCs on ads1.MATHUOC equals ads2.MATHUOC
                     where ads.MADONTHUOCMAU == MADONTHUOCMAU && ads.MABACSY == MABACSY
                     select new { ads, ads1, ads2 };
         foreach (var row in query)
         {
             cDonThuocMauChiTietDO dss = new cDonThuocMauChiTietDO();
             dss.STT = row.ads1.STT;
             dss.MADONTHUOCMAU1 = row.ads1.MADONTHUOCMAU;
             dss.MATHUOC = row.ads1.MATHUOC;
             dss.TENTHUONGMAI = row.ads2.TENTHUONGMAI;
             dss.SOLUONG = row.ads1.SOLUONG.ToString();
             dss.SOLANDUNG = row.ads1.SOLANDUNG.ToString();
             dss.SOLUONGDUNG = row.ads1.SOLUONGDUNG.ToString();
             dss.DONVI = row.ads2.DONVI;
             dss.DONVIDUNG = row.ads2.DONVIDUNG;
             dss.CACHDUNG = row.ads2.CACHDUNG;
             dss.GHICHU = row.ads2.GHICHU;
             dsbenhan.Add(dss);
         }
         return dsbenhan;
     }
 }
예제 #4
0
 public static string GetPassword(string Manhanvien)
 {
     using (DB_HMS_Entities Pass = new DB_HMS_Entities())
     {
         var query = (from u in Pass.tbNHANVIENs
                      where u.MANHANVIEN == Manhanvien
                      select u).First();
         return query.MATKHAU;
     }
 }
예제 #5
0
 public static void DeleteDonthuocchitiet(string MADONTHUOCMAU, string MABACSI,string MATHUOC)
 {
     using (DB_HMS_Entities dk = new DB_HMS_Entities())
     {
         var query = (from c in dk.tbDONTHUOCMAUCHITIETs
                      where c.MADONTHUOCMAU == MADONTHUOCMAU && c.MABACSI == MABACSI && c.MATHUOC==MATHUOC
                      select c).First();
         dk.DeleteObject(query);
         dk.SaveChanges();
     }
 }
예제 #6
0
        /// <summary>
        /// Hàm delete 1 quốc gia ở database
        /// </summary>
        /// <param name="maquocgia"></param>
        public static void DeleteBenhtheopk(string MABENH ,string MAPHONGKHAM)
        {
            using (DB_HMS_Entities dk = new DB_HMS_Entities())
            {
                var query = (from c in dk.tbBENHPHONGKHAMs
                             where c.MABENH == MABENH && c.MAPHONGKHAM== MAPHONGKHAM
                             select c).First();

                dk.DeleteObject(query);
                dk.SaveChanges();
            }
        }
 public static void InsertFunctionofGroup(string MaNhomNhanVien, string MaTinhNang)
 {
     using (DB_HMS_Entities Group = new DB_HMS_Entities())
     {
         tbTINHNANGNHOMND lst = new tbTINHNANGNHOMND();
         lst.MATINHNANG = MaTinhNang;
         lst.MANHOMND = MaNhomNhanVien;
         lst.NGAYTAO = DateTime.Today;
         Group.AddTotbTINHNANGNHOMNDs(lst);
         Group.SaveChanges();
     }
 }
        public static void DeleteFunctionofGroup(string MaNhomNhanVien)
        {
            using (DB_HMS_Entities lst = new DB_HMS_Entities())
            {
                var query = from u in lst.tbTINHNANGNHOMNDs where u.MANHOMND == MaNhomNhanVien select u;
                foreach (var row in query)
                {
                    lst.DeleteObject(row);

                }
                lst.SaveChanges();
            }
        }
예제 #9
0
 public static void InsertToathuoc( string MABENHAN, string MATHUOC, string SOLUONG, string SOLANDUNG, string SOLUONGDUNG,DateTime NGAYTAO)
 {
     using (DB_HMS_Entities dk = new DB_HMS_Entities())
     {
         tbKETOATHUOC sl = new tbKETOATHUOC();
         sl.MABENHAN = MABENHAN;
         sl.SOLUONG = Int32.Parse(SOLUONG);
         sl.SOLANDUNG = Int32.Parse(SOLANDUNG);
         sl.SOLUONGDUNG = Int32.Parse(SOLUONGDUNG);
         sl.NGAYTAO = NGAYTAO;
         dk.SaveChanges();
     }
 }
예제 #10
0
 public static string GetNameByGroupID(string ID)
 {
     ID = ID.ToLower();
     cNhomNhanVienDO group = new cNhomNhanVienDO();
     using (DB_HMS_Entities lst = new DB_HMS_Entities())
     {
         var query = from u in lst.tbNHOMNGUOIDUNGs where u.MANHOMNDN == ID select u;
         foreach (var row in query)
         {
             group.TENNHOMNHANVIEN = row.TENNHOMND;
         }
     }
     return group.TENNHOMNHANVIEN;
 }
예제 #11
0
 public static string GetIDByClinicName(string Name)
 {
     Name = Name.ToLower();
     cPhongKhamDO group = new cPhongKhamDO();
     using (DB_HMS_Entities lst = new DB_HMS_Entities())
     {
         var query = from u in lst.tbPHONGKHAMs where u.TENPHONG == Name select u;
         foreach (var row in query)
         {
             group.MAPHONGKHAM = row.MAPHONGKHAM;
         }
     }
     return group.MAPHONGKHAM;
 }
예제 #12
0
 public static string GetIDByGroupName(string Name)
 {
     Name = Name.ToLower();
     cNhomNhanVienDO group = new cNhomNhanVienDO();
     using (DB_HMS_Entities lst = new DB_HMS_Entities())
     {
         var query = from u in lst.tbNHOMNGUOIDUNGs where u.TENNHOMND == Name select u;
         foreach (var row in query)
         {
             group.MANHOMNHANVIEN = row.MANHOMNDN;
         }
     }
     return group.MANHOMNHANVIEN;
 }
예제 #13
0
 /// <summary>
 /// get mã sinh liệu
 /// </summary>
 /// <returns></returns>
 public static string Getmasl()
 {
     using (DB_HMS_Entities ds = new DB_HMS_Entities())
     {
         string masl = null;
         var query = (from dss in ds.tbSINHLIEUx
                      orderby dss.MASINHLIEU descending
                      select dss).Skip(0).Take(1);
         foreach (var row in query)
         {
             masl = row.MASINHLIEU;
         }
         return masl;
     }
 }
예제 #14
0
 public static string GetStaffID()
 {
     using (DB_HMS_Entities Staff = new DB_HMS_Entities())
     {
         string StaffID = null;
         var query = (from u in Staff.tbNHANVIENs
                      orderby u.MANHANVIEN descending
                      select u).Skip(0).Take(1);
         foreach (var row in query)
         {
             StaffID = row.MANHANVIEN;
         }
         return StaffID;
     }
 }
예제 #15
0
 public static string GetStaffGroupID()
 {
     using (DB_HMS_Entities Group = new DB_HMS_Entities())
     {
         string GroupID = null;
         var query = (from u in Group.tbNHOMNGUOIDUNGs
                      orderby u.MANHOMNDN descending
                      select u).Skip(0).Take(1);
         foreach (var row in query)
         {
             GroupID = row.MANHOMNDN;
         }
         return GroupID;
     }
 }
예제 #16
0
 public static List<cTinhNangDO> GetFunctionList()
 {
     List<cTinhNangDO> list = new List<cTinhNangDO>();
     using (DB_HMS_Entities lst = new DB_HMS_Entities())
     {
         var query = (from u in lst.tbTINHNANGs select u);
         foreach (var row in query)
         {
             cTinhNangDO ds = new cTinhNangDO();
             ds.MATINHNANG = row.MATINHNANG;
             ds.TENTINHNANG = row.TENTINHNANG;
             list.Add(ds);
         }
     }
     return list;
 }
예제 #17
0
 public static bool CheckExist(string TENNHOM)
 {
     bool exist = false;
     using (DB_HMS_Entities Group = new DB_HMS_Entities())
     {
         var query = (from u in Group.tbNHOMNGUOIDUNGs where u.TENNHOMND == TENNHOM select u);
         foreach (var row in query)
         {
             if (row.TENNHOMND.ToLower() == TENNHOM.ToLower())
             {
                 exist = true;
             }
         }
     }
     return exist;
 }
예제 #18
0
 public static void UpdateToathuoc(string MABENHAN, string MATHUOC, string SOLUONG, string SOLANDUNG, string SOLUONGDUNG,DateTime NGAYTAO)
 {
     using (DB_HMS_Entities ds = new DB_HMS_Entities())
     {
         tbKETOATHUOC pk = new tbKETOATHUOC();
         var query = (from dss in ds.tbKETOATHUOCs
                      where dss.MABENHAN == MABENHAN
                      select dss).First();
         //query.MABENH = MABENH;
         query.MATHUOC = MATHUOC;
         query.SOLUONG = int.Parse(SOLUONG);
         query.SOLANDUNG = int.Parse(SOLANDUNG);
         query.SOLUONGDUNG = int.Parse(SOLUONGDUNG);
         query.NGAYTAO = NGAYTAO;
         ds.SaveChanges();
     }
 }
 public static List<cTinhNangNhomNhanVienDO> GetFunctionofGroupList()
 {
     List<cTinhNangNhomNhanVienDO> GroupList = new List<cTinhNangNhomNhanVienDO>();
     using (DB_HMS_Entities lst = new DB_HMS_Entities())
     {
         var query = from u in lst.tbTINHNANGNHOMNDs select u;
         foreach (var row in query)
         {
             cTinhNangNhomNhanVienDO ds = new cTinhNangNhomNhanVienDO();
             ds.MATINHNANG = row.MATINHNANG;
             ds.MANHOMNHANVIEN = row.MANHOMND;
             ds.NGAYTAO = (DateTime) row.NGAYTAO;
             GroupList.Add(ds);
         }
         return GroupList;
     }
 }
예제 #20
0
 public static bool CheckDonthuocmau(string MADONTHUOCMAU, string MABACSI)
 {
     Boolean ktbenhpk = false;
     using (DB_HMS_Entities ds = new DB_HMS_Entities())
     {
         var query = (from dss in ds.tbDONTHUOCMAUs
                      where dss.MADONTHUOCMAU == MADONTHUOCMAU && dss.MABACSY == MABACSI
                      select dss);
         foreach (var row in query)
         {
             if (row.MADONTHUOCMAU == MADONTHUOCMAU || row.MABACSY ==MABACSI)
             {
                 ktbenhpk = true;
             }
         }
     }
     return ktbenhpk;
 }
예제 #21
0
 public static bool CheckUser(string username, string password)
 {
     Boolean test = false;
     using (DB_HMS_Entities dk = new DB_HMS_Entities())
     {
         var query = from c in dk.tbNHANVIENs
                     where c.IDDANGNHAP == username && c.MATKHAU == password
                     select c;
         foreach (var row in query)
         {
             if (row.IDDANGNHAP == username || row.MATKHAU == password)
             {
                 test = true;
             }
         }
     }
     return test;
 }
예제 #22
0
 public static bool CheckThuoctrongdonthuoc(string MADONTHUOCMAU, string MABACSI ,string MATHUOC)
 {
     Boolean ktbenhpk = false;
     using (DB_HMS_Entities ds = new DB_HMS_Entities())
     {
         var query = (from dss in ds.tbDONTHUOCMAUCHITIETs
                      where dss.MADONTHUOCMAU == MADONTHUOCMAU && dss.MABACSI == MABACSI && dss.MATHUOC==MATHUOC
                      select dss);
         foreach (var row in query)
         {
             if (row.MADONTHUOCMAU == MADONTHUOCMAU || row.MABACSI == MABACSI || row.MATHUOC==MATHUOC)
             {
                 ktbenhpk = true;
             }
         }
     }
     return ktbenhpk;
 }
예제 #23
0
 /// <summary>
 /// Kiem tra phong kham co trung hay khong
 /// </summary>
 /// <param name="TENPHONG"></param>
 /// <returns></returns>
 public static bool Checkphongkham(string TENPHONG)
 {
     Boolean ktphongkham = false;
     using (DB_HMS_Entities ds = new DB_HMS_Entities())
     {
         var query = (from dss in ds.tbPHONGKHAMs
                      where dss.TENPHONG == TENPHONG.Trim()
                      select dss);
         foreach (var row in query)
         {
             if (row.TENPHONG == TENPHONG)
             {
                 ktphongkham = true;
             }
         }
     }
     return ktphongkham;
 }
 public static List<cTinhNangNhomNhanVienDO> GetListOfFunctionByGroupID(string GroupID)
 {
     GroupID = GroupID.ToLower();
     List<cTinhNangNhomNhanVienDO> lstFunction = new List<cTinhNangNhomNhanVienDO>();
     using (DB_HMS_Entities lst = new DB_HMS_Entities())
     {
         var query = from u in lst.tbTINHNANGNHOMNDs where u.MANHOMND == GroupID select u;
         foreach (var row in query)
         {
             cTinhNangNhomNhanVienDO ds = new cTinhNangNhomNhanVienDO();
             ds.MATINHNANG = row.MATINHNANG;
             ds.MANHOMNHANVIEN = row.MANHOMND;
             ds.NGAYTAO = (DateTime)row.NGAYTAO;
             lstFunction.Add(ds);
         }
         return lstFunction;
     }
 }
예제 #25
0
 /// <summary>
 /// kiểm tra mã bệnh đó đã tồn tại hay chưa
 /// </summary>
 /// <param name="MABENH"></param>
 /// <returns></returns>
 public static bool CheckBenhtheopk(string MABENH, string MAPHONGKHAM)
 {
     Boolean ktbenhpk = false;
     using (DB_HMS_Entities ds = new DB_HMS_Entities())
     {
         var query = (from dss in ds.tbBENHPHONGKHAMs
                      where dss.MABENH == MABENH.Trim()&& dss.MAPHONGKHAM==MAPHONGKHAM.Trim()
                      select dss);
         foreach (var row in query)
         {
             if (row.MABENH == MABENH || row.MAPHONGKHAM== MAPHONGKHAM)
             {
                 ktbenhpk = true;
             }
         }
     }
     return ktbenhpk;
 }
예제 #26
0
 /// <summary>
 /// Lay danh sach benh theo phong kham tu entities
 /// </summary>
 /// <returns></returns>
 public static List<cBenhTheoPKDO> Getdsbenhtheopk()
 {
     List<cBenhTheoPKDO> dsbenhtheopk = new List<cBenhTheoPKDO>();
     using (DB_HMS_Entities ds = new DB_HMS_Entities())
     {
         var query = from ads in ds.tbBENHPHONGKHAMs
                     select ads;
         foreach (var row in query)
         {
             cBenhTheoPKDO dss = new cBenhTheoPKDO();
             dss.MABENH = row.MABENH;
             dss.MAPHONGKHAM = row.MAPHONGKHAM;
             dss.NGAYTAO = row.NGAYTAO.Value;
             dsbenhtheopk.Add(dss);
         }
         return dsbenhtheopk;
     }
 }
예제 #27
0
 /// <summary>
 /// Kiểm tra người dùng tồn tại dưới cơ sở dữ liệu
 /// </summary>
 /// <param name="MATHUOC"></param>
 /// <returns></returns>
 public static bool CheckMedicine(string MATHUOC)
 {
     Boolean test = false;
     using (DB_HMS_Entities dk = new DB_HMS_Entities())
     {
         var query = from ck in dk.tbTHUOCs
                     where ck.MATHUOC == MATHUOC
                     select ck;
         foreach (var row in query)
         {
             if (row.MATHUOC == MATHUOC)
             {
                 test = true;
             }
         }
     }
     return test;
 }
예제 #28
0
 public static List<cNhomNhanVienDO> GetStaffGroupList()
 {
     List<cNhomNhanVienDO> GroupList = new List<cNhomNhanVienDO>();
     using (DB_HMS_Entities lst = new DB_HMS_Entities())
     {
         var query = from u in lst.tbNHOMNGUOIDUNGs select u;
         foreach (var row in query)
         {
             cNhomNhanVienDO ds = new cNhomNhanVienDO();
             ds.MANHOMNHANVIEN = row.MANHOMNDN;
             ds.TENNHOMNHANVIEN = row.TENNHOMND;
             ds.MOTA = row.MOTA;
             ds.TRANGTHAI = row.TRANGTHAI.Value;
             GroupList.Add(ds);
         }
         return GroupList;
     }
 }
예제 #29
0
 /// <summary>
 /// Lay danh sach phong kham tu entities
 /// </summary>
 /// <returns></returns>
 public static List<cPhongKhamDO> Getdsphongkham()
 {
     List<cPhongKhamDO> dsphongkham = new List<cPhongKhamDO>();
     using (DB_HMS_Entities ds = new DB_HMS_Entities())
     {
         var query = from ads in ds.tbPHONGKHAMs
                     select ads;
         foreach(var row in query)
         {
             cPhongKhamDO dss = new cPhongKhamDO();
             dss.MAPHONGKHAM = row.MAPHONGKHAM;
             dss.TENPHONG = row.TENPHONG;
             dss.NGAYTAO = row.NGAYTAO.Value;
             dss.TRANGTHAI = row.TRANGTHAI.Value;
             dsphongkham.Add(dss);
         }
         return dsphongkham;
     }
 }
예제 #30
0
 public static cNhanVienDO GetStaffByID(string ID)
 {
     ID = ID.ToLower();
     cNhanVienDO staff = new cNhanVienDO();
     using (DB_HMS_Entities lst = new DB_HMS_Entities())
     {
         var query = (from u in lst.tbNHANVIENs where u.MANHANVIEN == ID select u).First();
         staff.MANHANVIEN = query.MANHANVIEN;
         staff.TENNHANVIEN = query.HOTEN;
         staff.GIOITINH = query.GIOITINH;
         staff.MANHOMNHANVIEN = query.MANHOMND;
         staff.MAPHONGKHAM = query.MAPHONGKHAM;
         staff.NGAYTAO = (DateTime)query.NGAYTAO;
         staff.TENTAIKHOAN = query.IDDANGNHAP;
         staff.MATKHAU = query.MATKHAU;
         staff.CHUCDANH = query.CHUCDANH;
         staff.TINHTRANG = (bool)query.TRANGTHAI;
         return staff;
     }
 }