예제 #1
0
        public static bool kt_dangnhap(string ten, string matkhau)
        {
            //Lnhanvien nv = new Lnhanvien();
            try
            {
                KTdangnhap P   = new KTdangnhap();
                DataSet    ds1 = P.ds;
                ketnoi.ThietlapketNoi();
                laydulieu dl = new laydulieu();
                ds1 = dl.getdata("select * from nhanvien where matkhau = '" + matkhau + "' and tendangnhap = '" + ten + "'");
                if (ds1.Tables[0].Rows.Count == 0)
                {
                    ketnoi.HuyKetNoi(); return(false);
                }
                else
                {
                    strmanhanvien = ds1.Tables[0].Rows[0]["manhanvien"].ToString();
                    strhoten      = ds1.Tables[0].Rows[0]["hoten"].ToString();
                    strdiachi     = ds1.Tables[0].Rows[0]["diachi"].ToString();
                    strnguoidung  = ds1.Tables[0].Rows[0]["tendangnhap"].ToString();
                    strquyenhan   = ds1.Tables[0].Rows[0]["quyenhan"].ToString();


                    strmatkhau = ds1.Tables[0].Rows[0]["matkhau"].ToString();
                    ketnoi.HuyKetNoi();
                    return(true);
                }
            }
            catch { return(false); }
        }
예제 #2
0
        public bool kt_dangnhap(string ten, string matkhau, string tenserver)
        {
            //Lnhanvien nv = new Lnhanvien();
            try
            {
                if (tenserver != "")
                {
                    ketnoi.strcon = ketnoi.strcon + "; server= " + tenserver;
                }
                ketnoi.ThietlapketNoi();
                laydulieu dl = new laydulieu();
                ds = dl.getdata("select * from nhanvien where matkhau = '" + matkhau + "' and tendangnhap = '" + ten + "'");
                if (ds.Tables[0].Rows.Count == 0)
                {
                    ketnoi.HuyKetNoi(); return(false);
                }
                else
                {
                    strmanhanvien = ds.Tables[0].Rows[0]["manhanvien"].ToString();
                    strhoten      = ds.Tables[0].Rows[0]["hoten"].ToString();
                    strdiachi     = ds.Tables[0].Rows[0]["diachi"].ToString();
                    strnguoidung  = ds.Tables[0].Rows[0]["tendangnhap"].ToString();
                    strquyenhan   = ds.Tables[0].Rows[0]["quyenhan"].ToString();


                    strmatkhau = ds.Tables[0].Rows[0]["matkhau"].ToString();
                    ketnoi.HuyKetNoi();
                    return(true);
                }
            }
            catch { return(false); }
        }
예제 #3
0
        public bool taomoi()
        {
            laydulieu ld = new laydulieu();

            if (ld.thucthitruyvan(" insert into nhanvien(manhanvien,hoten,diachi,tendangnhap,matkhau,quyenhan) values ('" + manhanvien + "',N'" + hoten + "',N'" + diachi + "',N'" + tendangnhap + "','" + matkhau + "','" + quyenhan + "')") == 1)
            {
                ketnoi.HuyKetNoi();
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #4
0
        public bool xoabo()
        {
            laydulieu ld = new laydulieu();

            if (ld.thucthitruyvan(" delete from nhanvien where manhanvien= '" + manhanvien + "'") == 1)
            {
                ketnoi.HuyKetNoi();
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #5
0
        public bool capnhat()
        {
            laydulieu ld = new laydulieu();

            if (ld.thucthitruyvan(" update nhanvien set manhanvien='" + manhanvien + "',hoten=N'" + hoten + "',diachi=N'" + diachi + "',tendangnhap=N'" + tendangnhap + "' where manhanvien='" + manhanvien + "'") == 1)
            {
                ketnoi.HuyKetNoi();
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #6
0
        public bool doimatkhau(string moi)
        {
            laydulieu ld = new laydulieu();

            matkhau = moi;
            if (ld.thucthitruyvan(" update nhanvien set matkhau=N'" + moi + "' where manhanvien='" + manhanvien + "'") == 1)
            {
                ketnoi.HuyKetNoi();
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #7
0
        public bool nangquyen(string quyenmoi)
        {
            this.quyenhan = quyenmoi;
            laydulieu ld = new laydulieu();

            if (ld.thucthitruyvan(" update nhanvien set quyenhan ='" + quyenmoi + "' where manhanvien = '" + manhanvien + "'") == 1)
            {
                ketnoi.HuyKetNoi();
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #8
0
        public static bool kt_nhapSoPhongDoi(string SoPhongDoi)
        {
            try
            {
                if (SoPhongDoi == "")
                {
                    return(true);
                }
                DataSet ds1 = new DataSet();


                ketnoi.ThietlapketNoi();
                laydulieu dl = new laydulieu();
                ds1 = dl.getdata("insert into khachhang(phongdon)values('" + SoPhongDoi + "')");
                return(false);
            }
            catch { return(true); }
        }
예제 #9
0
        public static bool kt_nhapTGThue(string TGThue)
        {
            try
            {
                if (TGThue == "")
                {
                    return(true);
                }
                DataSet ds1 = new DataSet();


                ketnoi.ThietlapketNoi();
                laydulieu dl = new laydulieu();
                ds1 = dl.getdata("insert into khachhang(songay)values('" + TGThue + "')");
                return(false);
            }
            catch { return(true); }
        }
예제 #10
0
        public static bool kt_trungmacheckin(string macheckin)
        {
            try
            {
                DataSet ds1 = new DataSet();

                ketnoi.ThietlapketNoi();
                laydulieu dl = new laydulieu();

                ds1 = dl.getdata("select * from checkin where macheckin = '" + macheckin + "' ");
                if (ds1.Tables[0].Rows.Count == 0)
                {
                    ketnoi.HuyKetNoi(); return(true);
                }
                else
                {
                    MessageBox.Show("Mã check in đã tồn tại!", "Chú ý");
                    ketnoi.HuyKetNoi();
                    return(false);
                }
            }
            catch { return(true); }
        }