Ejemplo n.º 1
0
        protected void btn_login_Click(object sender, EventArgs e)
        {
            NguoiDungController kt = new NguoiDungController();
            string        ad       = txt_user.Text;
            NguoiDungInfo info     = kt.Check_Login(txt_user.Text, txt_pass.Text);

            if (info != null)
            {
                if (info.Quyen)
                {
                    Session["TenDangNhap"] = info.TenDangNhap;
                    Response.Redirect("~/Admin/ADIndex.aspx");
                }
                else
                {
                    Session["TenDangNhap"] = info.TenDangNhap;
                }
                Session["Email"]  = info.Email;
                Session["HoTen"]  = info.HoTen;
                Session["SDT"]    = info.SDT;
                Session["DiaChi"] = info.DiaChi;
                Session["quyen"]  = info.Quyen;
                Response.Redirect("~/Home.aspx");
            }
            else
            {
                tb.Text = "Sai Tên Hoặc Mật Khẩu!";
            }
        }
Ejemplo n.º 2
0
        protected void btn_DangNhap_Click(object sender, EventArgs e)
        {
            NguoiDungController kt = new NguoiDungController();
            string        ten      = txtTen.Text;
            NguoiDungInfo info     = kt.Check_Login(txtTen.Text, txtMatKhau.Text);

            if (info != null)
            {
                Session["TenDN"]    = info.TenDN;
                Session["HoTen"]    = info.HoTen;
                Session["NgaySinh"] = info.NgaySinh;
                Session["GioiTinh"] = info.GioiTinh;
                Session["DiaChi"]   = info.DiaChi;
                Session["Email"]    = info.Email;
                Response.Redirect("~/Home.aspx");
            }
            else
            {
                lbTB.Text = "Sai Tên Hoặc Mật Khẩu!";
            }
        }