Exemplo n.º 1
0
        //+++ ham dang nhap

        public bool Login(string tk, string mk)
        {
            TAIKHOAN     TK      = new TAIKHOAN();
            DataProvider context = new DataProvider();
            //TK.TENTAIKHOAN = tk

            TAIKHOAN DN = context.TAIKHOANs.FirstOrDefault(p => p.TENTAIKHOAN == tk && p.MATKHAU == mk);

            if (DN != null)
            {
                return(true);
            }
            return(false);
        }
Exemplo n.º 2
0
        public bool checkUserName(string Tk)
        {
            TAIKHOAN     tk      = new TAIKHOAN();
            DataProvider context = new DataProvider();

            tk.TENTAIKHOAN = Tk;
            TAIKHOAN tkDH = context.TAIKHOANs.FirstOrDefault(p => p.TENTAIKHOAN == tk.TENTAIKHOAN);

            if (tkDH == null)
            {
                return(true);
            }
            return(false);
        }
Exemplo n.º 3
0
        //+++ ham chuc nang
        public void addAccount(string tk, string mk)
        {
            TAIKHOAN     TK        = new TAIKHOAN();
            DataProvider contextDB = new DataProvider();

            TK.TENTAIKHOAN = tk;
            TK.MATKHAU     = mk;

            TAIKHOAN tkDH = contextDB.TAIKHOANs.FirstOrDefault(p => p.MATK.ToString() == TK.MATK.ToString());

            if (tkDH == null)
            {
                contextDB.Database.ExecuteSqlCommand("Insert into TAIKHOAN( TENTAIKHOAN,MATKHAU) Values('" + TK.TENTAIKHOAN + "','" + TK.MATKHAU + "')");
                contextDB.SaveChanges();
            }
        }