示例#1
0
        // Sua PHIEUKHAM
        public static bool SuaPHIEUKHAM(PHIEUKHAM pkDTO)
        {
            // tao cau truy van
            // string sTruyVan = @"insert into PHIEUKHAM(MaBN,TenBN) value"; -- them mot vai thanh phan vao bang
            string sTruyVan = string.Format("update PHIEUKHAM set MaNV=N'{0}' , MaBN=N'{1}' , NgayKham=N'{2}' , TrieuChung=N'{3}'  where MaPK='{4}'", pkDTO.MaNV1, pkDTO.MaBN1, pkDTO.NgayKham1, pkDTO.TrieuChung1, pkDTO.MaPK1);

            Con = DataProvider_1.KetNoi();
            try
            {
                // thuc thi truy van
                bool KetQua = DataProvider_1.ThucThiTruyVanNonQuery(sTruyVan, Con);
                // dong ket noi
                DataProvider_1.DongKetNoi(Con);
                if (KetQua == true)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                DataProvider_1.DongKetNoi(Con);
                return(false);
            }
        }
        public bool KiemTraTonTai(BACSI bnDTO)
        {
            string sTruyVan = string.Format("SELECT MaBS from BACSI WHERE TenDangNhap =N'{0}'  AND TinhTrangTonTai = '1'", bnDTO.TenDangNhap1); // MaBN tu dong tang

            Con = DataProvider_1.KetNoi();
            try
            {
                // thuc thi truy van
                bool kq = DataProvider_1.ThucThiTruyVanNonQuery(sTruyVan, Con);
                // dong ket noi
                DataProvider_1.DongKetNoi(Con);

                if (kq == true)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                DataProvider_1.DongKetNoi(Con);
                return(false);
            }
        }
示例#3
0
        //Load PHIEUKHAM

        public static List <PHIEUKHAM> LoadPhieuKham()
        {
            // khai bao truy van sql
            string sTruyVan = "select * from PHIEUKHAM WHERE TrangThai = '1'";

            // Mo ket noi
            Con = DataProvider_1.KetNoi();
            // Tien hanh truy van
            DataTable dt = DataProvider_1.LayDataTable(sTruyVan, Con);

            if (dt.Rows.Count == 0)
            {
                return(null);
            }
            // tao List PHIEUKHAM_DTO
            List <PHIEUKHAM> listbn = new List <PHIEUKHAM>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                PHIEUKHAM bn = new PHIEUKHAM();
                bn.MaPK1       = int.Parse(dt.Rows[i]["MaPK"].ToString());
                bn.MaNV1       = int.Parse(dt.Rows[i]["MaNV"].ToString());
                bn.MaBN1       = int.Parse(dt.Rows[i]["MaBN"].ToString());
                bn.NgayKham1   = DateTime.Parse(dt.Rows[i]["NgayKham"].ToString());
                bn.TrieuChung1 = dt.Rows[i]["TrieuChung"].ToString();
                //bn.KetQua1 = dt.Rows[i]["KetQua"].ToString();
                listbn.Add(bn);
            }
            DataProvider_1.DongKetNoi(Con);
            return(listbn);
        }
示例#4
0
        // xoa thuoc
        public static bool XoaCTTT(string x)
        {
            String sTruyVan = string.Format("update CTTT set TrangThai = '0' where TenThuoc =N'{0}'", x);

            Con = DataProvider_1.KetNoi();
            try
            {
                // thuc thi truy van
                bool KetQua = DataProvider_1.ThucThiTruyVanNonQuery(sTruyVan, Con);

                // dong truy van
                DataProvider_1.DongKetNoi(Con);
                if (KetQua == true)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                DataProvider_1.DongKetNoi(Con);
                return(false);
            }
        }
        public List <BACSI> LoadBacSi()
        {
            // khai bao truy van sql
            string sTruyVan = "select * from BACSI where TinhTrangTonTai = '1'";

            // Mo ket noi
            Con = DataProvider_1.KetNoi();
            // Tien hanh truy van
            DataTable dt = DataProvider_1.LayDataTable(sTruyVan, Con);

            if (dt.Rows.Count == 0)
            {
                return(null);
            }
            // tao List PHIEUKHAM_DTO
            List <BACSI> listbs = new List <BACSI>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                BACSI bs = new BACSI();
                bs.MaBS1            = int.Parse(dt.Rows[i]["MaBS"].ToString());
                bs.TenBS1           = dt.Rows[i]["TenBS"].ToString();
                bs.TenDangNhap1     = dt.Rows[i]["TenDangNhap"].ToString();
                bs.Matkhau          = dt.Rows[i]["MatKhau"].ToString();
                bs.Loai1            = int.Parse(dt.Rows[i]["Loai"].ToString());
                bs.TinhTrangTonTai1 = int.Parse(dt.Rows[i]["TinhTrangTonTai"].ToString());

                listbs.Add(bs);
            }
            DataProvider_1.DongKetNoi(Con);
            return(listbs);
        }
        public bool XoaPhieKham(int x)
        {
            String sTruyVan = string.Format("update PHIEUKHAM set TinhTrangTonTai = '0' where MaPK ='{0}'", x);

            Con = DataProvider_1.KetNoi();
            try
            {
                // thuc thi truy van
                bool KetQua = DataProvider_1.ThucThiTruyVanNonQuery(sTruyVan, Con);

                // dong truy van
                DataProvider_1.DongKetNoi(Con);
                if (KetQua == true)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                DataProvider_1.DongKetNoi(Con);
                return(false);
            }
        }
示例#7
0
        // Them PHIEUKHAM
        public static bool ThemPHIEUKHAM(PHIEUKHAM bnDTO)
        {
            // tao cau truy van
            // string sTruyVan = @"insert into PHIEUKHAM(MaBN,TenBN) value"; -- them mot vai thanh phan vao bang
            string sTruyVan = string.Format("insert into PHIEUKHAM values ('{0}','{1}',N'{2}',N'{3}',N'{4}', '1')", bnDTO.MaNV1, bnDTO.MaBN1, bnDTO.NgayKham1, bnDTO.TrieuChung1, bnDTO.KetQua1);// them day du thong tin cua bang

            Con = DataProvider_1.KetNoi();
            try
            {
                // thuc thi truy van
                bool KetQua = DataProvider_1.ThucThiTruyVanNonQuery(sTruyVan, Con);
                // dong ket noi
                DataProvider_1.DongKetNoi(Con);
                if (KetQua == true)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                DataProvider_1.DongKetNoi(Con);
                return(false);
            }
        }
        public static bool ThemKetQuaVaoPhieuKham(PHIEUKHAM DTO)
        {
            string sTruyVan = string.Format("update PHIEUKHAM set KetQua = N'{0}' where MaPK={1}", DTO.KetQua1, DTO.MaPK1);

            Con = DataProvider_1.KetNoi();
            try
            {
                bool KetQua = DataProvider_1.ThucThiTruyVanNonQuery(sTruyVan, Con);

                DataProvider_1.DongKetNoi(Con);
                if (KetQua == true)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                DataProvider_1.DongKetNoi(Con);
                return(false);
            }
        }
        // sua benh nhan

        public bool SuaBacSi(BACSI bnDTO)
        {
            string sTruyVan = string.Format("update BACSI set TenBS = N'{0}', TenDangNhap = N'{1}', MatKhau = N'{2}' , Loai = '{3}'  where MaBS= N'{4}'", bnDTO.TenBS1, bnDTO.TenDangNhap1, bnDTO.Matkhau, bnDTO.Loai1, bnDTO.MaBS1);

            Con = DataProvider_1.KetNoi();
            try
            {
                // thuc thi truy van
                bool KetQua = DataProvider_1.ThucThiTruyVanNonQuery(sTruyVan, Con);
                // dong truy van
                DataProvider_1.DongKetNoi(Con);
                if (KetQua == true)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                DataProvider_1.DongKetNoi(Con);
                return(false);
            }
        }
示例#10
0
        // xoa benh nhan
        public static bool XoaBenhNhan(BENHNHAN bnDTO)
        {
            String sTruyVan = string.Format("update BENHNHAN set TrangThai = '0' where MaBN ='{0}'", bnDTO.MaBN1);

            Con = DataProvider_1.KetNoi();
            try
            {
                // thuc thi truy van
                bool KetQua = DataProvider_1.ThucThiTruyVanNonQuery(sTruyVan, Con);

                // dong truy van
                DataProvider_1.DongKetNoi(Con);
                if (KetQua == true)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                DataProvider_1.DongKetNoi(Con);
                return(false);
            }
        }
示例#11
0
        public static List <CTTT> LoadCTTT(int MaPK)
        {
            string sTruyVan = string.Format("select * from CTTT WHERE MaPK ='{0}'", MaPK);

            // Mo ket noi
            Con = DataProvider_1.KetNoi();
            // Tien hanh truy van
            DataTable dt = DataProvider_1.LayDataTable(sTruyVan, Con);

            if (dt.Rows.Count == 0)
            {
                return(null);
            }
            // tao List BenhNhan_DTO
            List <CTTT> listbn = new List <CTTT>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                CTTT DTO = new CTTT();

                DTO.MaPK1     = int.Parse(dt.Rows[i]["MaPK"].ToString());
                DTO.MaThuoc1  = int.Parse(dt.Rows[i]["MaThuoc"].ToString());
                DTO.SoLuong1  = int.Parse(dt.Rows[i]["SoLuong"].ToString());
                DTO.DonGia1   = float.Parse(dt.Rows[i]["DonGia"].ToString());
                DTO.CachDung1 = dt.Rows[i]["CachDung"].ToString();
            }
            DataProvider_1.DongKetNoi(Con);
            return(listbn);
        }
        // them - sua - xoa table BACSI

        public static DataTable BangKiemTraTonTai(BACSI bnDTO)
        {
            // string sTruyVan = string.Format("SELECT MaBN from BENHNHAN WHERE (TenBN like N'{0}') and (NgaySinh = N'{1}' and (DienThoai = '{2}' and GioiTinh = N'{3}'))", bnDTO.TenBN1, bnDTO.NgaySinh1, bnDTO.DienThoai1, bnDTO.GioiTinh1); // MaBN tu dong tang
            string sTruyVan = string.Format("SELECT MaBS from BACSI WHERE TenDangNhap =N'{0}' AND TinhTrangTonTai = '1'", bnDTO.TenDangNhap1);

            try
            {
                DataTable dt = DataProvider_1.LayDataTable(sTruyVan, Con);
                DataProvider_1.DongKetNoi(Con);
                if (dt.Rows.Count == 0)
                {
                    return(null);
                }
                else
                {
                    return(dt);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                DataProvider_1.DongKetNoi(Con);
                return(null);
            }
        }
示例#13
0
        // sua benh nhan

        public static bool SuaBenhNhan(BENHNHAN bnDTO)
        {
            string sTruyVan = string.Format("update BENHNHAN set TenBN = N'{0}', NgaySinh=N'{1}', DiaChi=N'{2}', DienThoai='{3}', GioiTinh=N'{4}' where MaBN={5}", bnDTO.TenBN1, bnDTO.NgaySinh1, bnDTO.DiaChi1, bnDTO.DienThoai1, bnDTO.GioiTinh1, bnDTO.MaBN1);

            Con = DataProvider_1.KetNoi();
            try
            {
                // thuc thi truy van
                bool KetQua = DataProvider_1.ThucThiTruyVanNonQuery(sTruyVan, Con);
                // dong truy van
                DataProvider_1.DongKetNoi(Con);
                if (KetQua == true)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                DataProvider_1.DongKetNoi(Con);
                return(false);
            }
        }
示例#14
0
        public static List <CTTT> LoadCTTT()
        {
            // khai bao truy van sql
            string sTruyVan = "select * from CTTT";

            // Mo ket noi
            Con = DataProvider_1.KetNoi();
            // Tien hanh truy van
            DataTable dt = DataProvider_1.LayDataTable(sTruyVan, Con);

            if (dt.Rows.Count == 0)
            {
                return(null);
            }
            // tao List PHIEUKHAM_DTO
            List <CTTT> listb = new List <CTTT>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                CTTT b = new CTTT();
                b.MaPK1     = int.Parse(dt.Rows[i]["MaPK"].ToString());
                b.MaThuoc1  = int.Parse(dt.Rows[i]["MaThuoc"].ToString());
                b.SoLuong1  = int.Parse(dt.Rows[i]["SoLuong"].ToString());
                b.DonGia1   = float.Parse(dt.Rows[i]["DonGia"].ToString());
                b.CachDung1 = dt.Rows[i]["CachDung"].ToString();

                listb.Add(b);
            }
            DataProvider_1.DongKetNoi(Con);
            return(listb);
        }
示例#15
0
        public static bool Sua(float TienKham)
        {
            string sTruyVan = string.Format("update QUIDINH set TienKham = N'{0}'", TienKham);

            Con = DataProvider_1.KetNoi();
            try
            {
                // thuc thi truy van
                bool KetQua = DataProvider_1.ThucThiTruyVanNonQuery(sTruyVan, Con);
                // dong truy van
                DataProvider_1.DongKetNoi(Con);
                if (KetQua == true)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                DataProvider_1.DongKetNoi(Con);
                return(false);
            }
        }
示例#16
0
        public static float LayGiaCu()
        {
            float  GiaCu = 0;
            string query = "select TienKham from QUIDINH";

            Con = DataProvider_1.KetNoi();
            try
            {
                DataTable dt = DataProvider_1.LayDataTable(query, Con);
                DataProvider_1.DongKetNoi(Con);
                if (dt.Rows.Count == 0)
                {
                    return(0);
                }
                //bn.TenThuoc1 = dt.Rows[i]["TenThuoc"].ToString();
                GiaCu = float.Parse(dt.Rows[0]["TienKham"].ToString());
                // GiaCu = float.Parse(dt.Rows.ToString());
                return(GiaCu);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                DataProvider_1.DongKetNoi(Con);
                return(0);
            }
            //DataTable dt = DataProvider.LoadTable(query, Con);
            //if (dt.Rows.Count == 0)
            //    return 0;

            //GiaCu = float.Parse(dt.Rows.ToString());
            //return GiaCu;
        }
示例#17
0
        // Them THUOC
        public static bool ThemTHUOC(THUOC bnDTO)
        {
            // tao cau truy van
            // string sTruyVan = @"insert into THUOC(MaBN,TenBN) value"; -- them mot vai thanh phan vao bang
            string sTruyVan = string.Format("insert into THUOC values (N'{0}',N'{1}','{2}', '1')", bnDTO.TenThuoc1, bnDTO.DonViTinh1, bnDTO.Gia1, bnDTO.TinhTrangTonTai1);    // them day du thong tin cua bang

            Con = DataProvider_1.KetNoi();
            try
            {
                // thuc thi truy van
                bool KetQua = DataProvider_1.ThucThiTruyVanNonQuery(sTruyVan, Con);
                // dong ket noi
                DataProvider_1.DongKetNoi(Con);
                if (KetQua == true)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                DataProvider_1.DongKetNoi(Con);
                return(false);
            }
            // DataProvider_1.DongKetNoi(Con);
        }
示例#18
0
        //Load benhnhan
        public static List <BENHNHAN> LoadBenhNhan()
        {
            // khai bao truy van sql
            string sTruyVan = "select * from BENHNHAN where TrangThai = '1'";

            // Mo ket noi
            Con = DataProvider_1.KetNoi();
            // Tien hanh truy van
            DataTable dt = DataProvider_1.LayDataTable(sTruyVan, Con);

            if (dt.Rows.Count == 0)
            {
                return(null);
            }
            // tao List BenhNhan_DTO
            List <BENHNHAN> listbn = new List <BENHNHAN>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                BENHNHAN bn = new BENHNHAN();

                // bn.MaBN1 = dt.Rows[i]["MaBN"].ToString(); // MaBN kieu string
                bn.MaBN1      = int.Parse(dt.Rows[i]["MaBN"].ToString());
                bn.TenBN1     = dt.Rows[i]["TenBN"].ToString();
                bn.NgaySinh1  = DateTime.Parse(dt.Rows[i]["NgaySinh"].ToString());
                bn.DiaChi1    = dt.Rows[i]["DiaChi"].ToString();
                bn.DienThoai1 = dt.Rows[i]["DienThoai"].ToString();
                bn.GioiTinh1  = dt.Rows[i]["GioiTinh"].ToString();
                bn.TrangThai1 = int.Parse(dt.Rows[i]["TrangThai"].ToString());
                listbn.Add(bn);
            }
            DataProvider_1.DongKetNoi(Con);
            return(listbn);
        }
示例#19
0
        // bac sy tham gia kham benh

        public List <NHANVIEN> LoadNHANVIENThamGiaKhamBenh()
        {
            // khai bao truy van sql
            string sTruyVan = "select * from NHANVIEN where TrangThai = '1' and LoaiNV ='2'";

            // Mo ket noi
            Con = DataProvider_1.KetNoi();
            // Tien hanh truy van
            DataTable dt = DataProvider_1.LayDataTable(sTruyVan, Con);

            if (dt.Rows.Count == 0)
            {
                return(null);
            }
            // tao List PHIEUKHAM_DTO
            List <NHANVIEN> listNV = new List <NHANVIEN>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                NHANVIEN NV = new NHANVIEN();
                NV.MaNV1        = int.Parse(dt.Rows[i]["MaNV"].ToString());
                NV.TenNV1       = dt.Rows[i]["TenNV"].ToString();
                NV.TenDangNhap1 = dt.Rows[i]["TenDangNhap"].ToString();
                NV.Matkhau1     = dt.Rows[i]["MatKhau"].ToString();
                NV.LoaiNV1      = int.Parse(dt.Rows[i]["LoaiNV"].ToString());
                NV.TrangThai1   = int.Parse(dt.Rows[i]["TrangThai"].ToString());
                listNV.Add(NV);
            }
            DataProvider_1.DongKetNoi(Con);
            return(listNV);
        }
示例#20
0
        public static bool KiemTraTonTai(BENHNHAN bnDTO)
        {
            string sTruyVan = string.Format("SELECT MaBN from BENHNHAN WHERE TrangThai = '1' and (TenBN like N'{0}') and (NgaySinh = N'{1}' and (DienThoai = '{2}' and GioiTinh = N'{3}'))", bnDTO.TenBN1, bnDTO.NgaySinh1, bnDTO.DienThoai1, bnDTO.GioiTinh1); // MaBN tu dong tang

            Con = DataProvider_1.KetNoi();
            try
            {
                // thuc thi truy van
                bool KetQua = DataProvider_1.ThucThiTruyVanNonQuery(sTruyVan, Con);
                // dong ket noi
                DataProvider_1.DongKetNoi(Con);
                if (KetQua == true)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                DataProvider_1.DongKetNoi(Con);
                return(false);
            }
        }
示例#21
0
        public static bool ThemVaoCTTT(CTTT DTO)
        {
            string sTruyVan = string.Format("insert into CTTT values ('{0}','{1}','{2}','{3}',N'{4}')", DTO.MaPK1, DTO.MaPK1, DTO.SoLuong1, DTO.DonGia1, DTO.CachDung1);  // MaBN tu dong tang

            Con = DataProvider_1.KetNoi();
            try
            {
                // thuc thi truy van
                bool KetQua = DataProvider_1.ThucThiTruyVanNonQuery(sTruyVan, Con);
                // dong ket noi
                DataProvider_1.DongKetNoi(Con);
                if (KetQua == true)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                DataProvider_1.DongKetNoi(Con);
                return(false);
            }
        }
示例#22
0
        public static bool SuaTHUOC(THUOC bnDTO)
        {
            string sTruyVan = string.Format("update THUOC set TenThuoc= N'{0}', DonViTinh=N'{1}', Gia={2} where MaThuoc='{3}'", bnDTO.TenThuoc1, bnDTO.DonViTinh1, bnDTO.Gia1, bnDTO.Mathuoc1);

            Con = DataProvider_1.KetNoi();
            try
            {
                // thuc thi truy van
                bool KetQua = DataProvider_1.ThucThiTruyVanNonQuery(sTruyVan, Con);
                // dong truy van
                DataProvider_1.DongKetNoi(Con);
                if (KetQua == true)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                DataProvider_1.DongKetNoi(Con);
                return(false);
            }
        }
        public bool ThemBacSi(BACSI bnDTO)
        {
            // tao cau truy van
            // string sTruyVan = @"insert into BENHNHAN(MaBN,TenBN) value"; -- them mot vai thanh phan vao bang
            /* string sTruyVan = string.Format("insert into BENHNHAN values ('{0}',N'{1}','{2}',N'{3}',{4},N'{5}')", bnDTO.MaBN1, bnDTO.TenBN1, bnDTO.NgaySinh1, bnDTO.DiaChi1, bnDTO.DienThoai1, bnDTO.GioiTinh1);*/ // them day du thong tin cua bang
            string sTruyVan = string.Format("insert into BACSI values (N'{0}', N'{1}', N'{2}', '{3}', '1')", bnDTO.TenBS1, bnDTO.TenDangNhap1, bnDTO.Matkhau, bnDTO.Loai1);                                           // MaBN tu dong tang

            Con = DataProvider_1.KetNoi();
            try
            {
                // thuc thi truy van
                bool kq = DataProvider_1.ThucThiTruyVanNonQuery(sTruyVan, Con);
                // dong ket noi
                DataProvider_1.DongKetNoi(Con);

                if (kq == true)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                DataProvider_1.DongKetNoi(Con);
                return(false);
            }
        }
示例#24
0
        //Load THUOC
        public static List <THUOC> LoadTHUOC()
        {
            // khai bao truy van sql
            string sTruyVan = "select * from THUOC where TinhTrangTonTai = '1'";

            // Mo ket noi
            Con = DataProvider_1.KetNoi();
            // Tien hanh truy van
            DataTable dt = DataProvider_1.LayDataTable(sTruyVan, Con);

            if (dt.Rows.Count == 0)
            {
                return(null);
            }
            // tao List THUOC_DTO
            List <THUOC> listbn = new List <THUOC>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                THUOC bn = new THUOC();
                bn.Mathuoc1  = int.Parse(dt.Rows[i]["MaThuoc"].ToString());
                bn.TenThuoc1 = dt.Rows[i]["TenThuoc"].ToString();

                bn.DonViTinh1 = dt.Rows[i]["DonViTinh"].ToString();

                bn.Gia1 = float.Parse(dt.Rows[i]["Gia"].ToString());

                bn.TinhTrangTonTai1 = int.Parse(dt.Rows[i]["TinhTrangTonTai"].ToString());

                listbn.Add(bn);
            }
            DataProvider_1.DongKetNoi(Con);
            return(listbn);
        }
示例#25
0
        public static bool XoaTHUOC(THUOC bnDTO)
        {
            DataTable dt = TaoBang(bnDTO);

            if (dt != null)
            {
                DuyetBang(dt);
            }

            String sTruyVan = string.Format("update THUOC set TinhTrangTonTai = '0' where MaThuoc ='{0}'", bnDTO.Mathuoc1);

            Con = DataProvider_1.KetNoi();
            try
            {
                // thuc thi truy van
                bool KetQua = DataProvider_1.ThucThiTruyVanNonQuery(sTruyVan, Con);
                // dong truy van
                DataProvider_1.DongKetNoi(Con);
                if (KetQua == true)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                DataProvider_1.DongKetNoi(Con);
                return(false);
            }
        }
        // xoa benh nhan
        public DataTable TaoBang(BACSI bnDTO)
        {
            string query = string.Format("SELECT MaPK from PHIEUKHAM, BACSI WHERE BACSI.MaBS = PHIEUKHAM.MaBS and TenDangNhap = N'{0}'", bnDTO.TenDangNhap1);

            Con = DataProvider_1.KetNoi();

            DataTable dt = DataProvider_1.LayDataTable(query, Con);

            DataProvider_1.DongKetNoi(Con);

            return(dt);
        }
        // xoa benh nhan
        public DataTable TaoBang(NHANVIEN bnDTO)
        {
            string query = string.Format("SELECT MaPK from PHIEUKHAM, NHANVIEN WHERE NHANVIEN.MaNV = PHIEUKHAM.MaNV and TenDangNhap = N'{0}'", bnDTO.TenDangNhap1);

            Con = DataProvider_1.KetNoi();

            DataTable dt = DataProvider_1.LayDataTable(query, Con);

            DataProvider_1.DongKetNoi(Con);

            return(dt);
        }
示例#28
0
        public static DataTable TaoBang(THUOC thuoc)
        {
            string query = string.Format("select CTTT.MaThuoc from CTTT  where  CTTT.MaThuoc =N'{0}'", thuoc.Mathuoc1);

            Con = DataProvider_1.KetNoi();

            DataTable dt = DataProvider_1.LayDataTable(query, Con);

            DataProvider_1.DongKetNoi(Con);

            if (dt.Rows.Count == 0)
            {
                return(null);
            }
            else
            {
                return(dt);
            }
        }
示例#29
0
        // xoa benh nhan
        public static bool XoaCTTT(CTTT CTTTDTO)
        {
            String sTruyVan = string.Format("delete from CTTT where MaBN ='{0}'", CTTTDTO.MaPK1);

            Con = DataProvider_1.KetNoi();
            try
            {
                // thuc thi truy van
                DataProvider_1.ThucThiTruyVanNonQuery(sTruyVan, Con);
                // dong truy van
                DataProvider_1.DongKetNoi(Con);
                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                DataProvider_1.DongKetNoi(Con);
                return(false);
            }
        }
示例#30
0
        // ham kiem tra ton tai
        public static bool KiemTraTonTai(THUOC bnDTO)
        {
            string sTruyVan = string.Format("SELECT MaThuoc from THUOC WHERE TenThuoc =N'{0}'  AND TinhTrangTonTai = '1'", bnDTO.TenThuoc1); // MaBN tu dong tang

            Con = DataProvider_1.KetNoi();
            try
            {
                // thuc thi truy van
                bool kq = DataProvider_1.ThucThiTruyVanNonQuery(sTruyVan, Con);
                // dong ket noi
                DataProvider_1.DongKetNoi(Con);

                if (kq == true)
                {
                    DataTable dt = DataProvider_1.LayDataTable(sTruyVan, Con);
                    DataProvider_1.DongKetNoi(Con);
                    if (dt.Rows.Count == 0)
                    {
                        return(false);
                    }
                    else
                    {
                        return(true);
                    }
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                DataProvider_1.DongKetNoi(Con);
                return(false);
            }
        }