public static bool Login(string tenDangNhap, string matKhau)
        {
            int       user = 0;
            NHAN_VIEN tmp;

            try
            {
                user = Convert.ToInt32(tenDangNhap);
            }
            catch (Exception)
            {
                user = 0;
            }
            try
            {
                tmp = NHAN_VIEN.select(" where MSNV = " + user + " and TRANG_THAI > 0 ")[0];
            }
            catch (Exception)
            {
                tmp = null;
            }
            if (tmp != null && tmp.MAT_KHAU == matKhau)
            {
                Init.nhanVien = tmp;
                return(true);
            }
            return(false);
        }
示例#2
0
        //	Employee leave
        public static bool SaThaiNhanVien(int msnv, string ghiChu)
        {
            LichSuNhanVien.SaThaiNhanVien(msnv, ghiChu);
            NHAN_VIEN nv = NHAN_VIEN.select(" where MSNV = " + msnv)[0];

            nv.TRANG_THAI = 0;
            NHAN_VIEN.update(nv);
            return(true);
        }
 //	Get Position of Employee
 public static int getChucVu(int user)
 {
     try
     {
         return(NHAN_VIEN.select(" where MSNV = " + user + " ")[0].MSNV);
     }
     catch (Exception)
     {
         return(0);
     }
 }
 public static NHAN_VIEN LayNhanVien(int msnv)
 {
     try
     {
         return(NHAN_VIEN.select(" where MSNV = " + msnv + " and TRANG_THAI = 1 ")[0]);
     }
     catch (Exception)
     {
         return(null);
     }
 }
 public static string LayHoTen(int MSNV)
 {
     try
     {
         return(NHAN_VIEN.select(" where MSNV = " + MSNV + " ")[0].HO_TEN);
     }
     catch (Exception)
     {
         return("");
     }
 }
 public static List <NHAN_VIEN> LayNhanVien()
 {
     return(NHAN_VIEN.select(" where TRANG_THAI = 1 "));
 }