Ejemplo n.º 1
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 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);
            }
        }
Ejemplo n.º 3
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);
            }
        }
Ejemplo n.º 4
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);
            }
        }
Ejemplo n.º 5
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);
            }
        }
        // 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);
            }
        }
        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);
            }
        }
Ejemplo n.º 8
0
        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);
            }
        }
        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);
            }
        }
Ejemplo n.º 10
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);
        }
Ejemplo n.º 11
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);
            }
        }
Ejemplo n.º 12
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);
            }
        }
Ejemplo n.º 13
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);
            }
        }
Ejemplo n.º 14
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);
            }
        }
Ejemplo n.º 15
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);
            }
        }
Ejemplo n.º 16
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);
            }
        }
Ejemplo n.º 17
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);
            }
        }
        public bool XoaNHANVIEN(NHANVIEN bnDTO)
        {
            DataTable dt = TaoBang(bnDTO);


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


            string sTruyVan = string.Format("update NHANVIEN set TrangThai = '0'  where MaNV= N'{0}'", bnDTO.MaNV1);

            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);
            }
        }
Ejemplo n.º 19
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);
            }
        }