예제 #1
0
 protected void btnDangnhap_Click(object sender, EventArgs e)
 {
     string taikhoan = txttaikhoan.Text.Trim();
     string matkhau = txtmatkhau.Text.Trim();
     NguoiDungBLL bll = new NguoiDungBLL();
     string check = bll.getQuyen(taikhoan);
     NguoiDungDTO dto = bll.login(taikhoan, matkhau);
     if (dto.Taikhoan == taikhoan && dto.Matkhau == matkhau)
     {
         switch (check)
         {
             case "admin": //Truong hop la admin
                 Session["idlogin"] = taikhoan;
                 Response.Write("<script>alert('Đăng nhập thành công!')</script>");
                 Response.Redirect("~/Admin/Default.aspx");
                 break;
             case "giaovien": //Truong hop la giao vien
                 Session["idlogin"] = taikhoan;
                 Response.Write("<script>alert('Đăng nhập thành công!')</script>");
                 Response.Redirect("~/Giaovien/GiaoVienPage.aspx");
                 break;
             case "hocsinh": //Truong hop la hoc sinh
                 Session["idlogin"] = taikhoan;
                 Response.Write("<script>alert('Đăng nhập thành công!')</script>");
                 Response.Redirect("~/Hocsinh/Default.aspx");
                 break;
         }
     }
     else
     {
         Response.Write("<script>alert('Đăng nhập không thành công!')</script>");
     }
 }
예제 #2
0
        private void LoadLoaiNguoiDung()
        {
            NguoiDungBLL nguoiDungBLL = new NguoiDungBLL();

            lkup_LoaiNguoiDung.DataSource    = nguoiDungBLL.LayLoaiNguoiDung();
            lkup_LoaiNguoiDung.ValueMember   = "ID_Loai_Nguoi_Dung";
            lkup_LoaiNguoiDung.DisplayMember = "Loai_ND";
        }
예제 #3
0
        public AccountForm()
        {
            InitializeComponent();
            bllND = new NguoiDungBLL();
            List <string> list = bllND.GetListQuyen();

            cbQuyen.DataSource = list;
            ((DataGridViewComboBoxColumn)dgvTaiKhoan.Columns["dgvcolQuyen"]).DataSource = cbQuyen.DataSource;
            GetDataTaiKhoan();
            dgvTaiKhoan.Columns["dgvcolQuyen"].ReadOnly = true;
        }
예제 #4
0
        private void btDangNhap_Click(object sender, EventArgs e)
        {
            NguoiDungBLL nguoidungbll = new NguoiDungBLL();
            string       username     = tbusername.Text.ToString();
            string       pass         = tbpassword.Text.ToString();

            if (nguoidungbll.DangNhap(username, pass))
            {
                Form1 form = new Form1();
                form.Show();
            }
            else
            {
                MessageBox.Show("loi dang nhap", "thong bao", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                tbusername.Text = "";
                tbpassword.Text = "";
            }
        }
예제 #5
0
        private void btXacNhan_Click(object sender, EventArgs e)
        {
            NguoiDungBLL      nguoidungbll  = new NguoiDungBLL();
            string            username      = tbTenDangNhap.Text.Trim();
            string            pass          = tbMatKhauCu.Text.Trim();
            string            passnew       = tbMatKhauMoi.Text.Trim();
            string            xacnhanpass   = bXacNhanMK.Text.Trim();
            NguoiDungEntities nguoidungenti = new NguoiDungEntities();

            nguoidungenti.Username = tbTenDangNhap.Text.Trim();
            nguoidungenti.Pass     = tbMatKhauCu.Text.Trim();
            nguoidungenti.Pass     = tbMatKhauMoi.Text.Trim();
            nguoidungenti.Pass     = bXacNhanMK.Text.Trim();
            if (nguoidungbll.DangNhap(username, pass))
            {
                nguoidungbll.update(nguoidungenti);
                MessageBox.Show("thay doi thanh cong", "thong bao", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                MessageBox.Show("thay doi that bai", "thong bao", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
예제 #6
0
    protected void btnDangnhap_Click(object sender, EventArgs e)
    {
        string       taikhoan = txttaikhoan.Text.Trim();
        string       matkhau  = txtmatkhau.Text.Trim();
        NguoiDungBLL bll      = new NguoiDungBLL();
        string       check    = bll.getQuyen(taikhoan);
        NguoiDungDTO dto      = bll.login(taikhoan, matkhau);

        if (dto.Taikhoan == taikhoan && dto.Matkhau == matkhau)
        {
            switch (check)
            {
            case "admin":     //Truong hop la admin
                Session["idlogin"] = taikhoan;
                Response.Write("<script>alert('Đăng nhập thành công!')</script>");
                Response.Redirect("~/Admin/Default.aspx");
                break;

            case "giaovien":     //Truong hop la giao vien
                Session["idlogin"] = taikhoan;
                Response.Write("<script>alert('Đăng nhập thành công!')</script>");
                Response.Redirect("~/Giaovien/GiaoVienPage.aspx");
                break;

            case "hocsinh":     //Truong hop la hoc sinh
                Session["idlogin"] = taikhoan;
                Response.Write("<script>alert('Đăng nhập thành công!')</script>");
                Response.Redirect("~/Hocsinh/Default.aspx");
                break;
            }
        }
        else
        {
            Response.Write("<script>alert('Đăng nhập không thành công!')</script>");
        }
    }
예제 #7
0
 public Form1()
 {
     InitializeComponent();
     this.ngdung = new NguoiDungBLL();
 }
예제 #8
0
 public DangNhap()
 {
     InitializeComponent();
     this.ngdung = new NguoiDungBLL();
 }
예제 #9
0
 public MatKhau()
 {
     InitializeComponent();
     nguoidung = new NguoiDungBLL();
 }