Beispiel #1
0
    protected void btnDangKy_Click(object sender, EventArgs e)
    {
        nguoidungBLL bs = new nguoidungBLL();

        if (bs.uniqueTK(txtTK.Text) == true)
        {
            lbError.Text = "Tài khoản này đã có người sử dụng !";
        }
        else if (bs.uniqueEmail(txtEmail.Text) == true)
        {
            lbError.Text = "Email này đã có người sử dụng !";
        }
        else
        {
            bool tf = bs.dangKy(txtTK.Text, txtMK2.Text, txtHoTen.Text, txtDT.Text, txtDiaChi.Text, txtEmail.Text);
            if (tf == true)
            {
                lbError.Text = "Đăng ký thành công !";
                Response.Redirect("dkthanhcong.aspx");
            }
            else
            {
                lbError.Text = "Đăng ký thất bại !";
            }
        }
    }
Beispiel #2
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        nguoidungBLL bs = new nguoidungBLL();

        if (bs.uniqueTK(txtTK.Text) == true)
        {
            lbTK.Text = "Tài khoản này đã có người sử dụng.";
        }
        else if (bs.uniqueEmail(txtEmail.Text) == true)
        {
            lbEmail.Text = "Email này đã có người sử dụng.";
        }
        else if (txtMK1.Text == txtMK2.Text)
        {
            bool tf = bs.add(txtTK.Text.Trim(), txtMK2.Text, txtHoTen.Text, txtSDT.Text, txtDiaChi.Text, txtEmail.Text, Convert.ToInt32(ddlRole.SelectedValue));
            if (tf == true)
            {
                Response.Redirect("nguoidung.aspx?add=t");
            }
            else
            {
                lbError.Text = "<div class='error'>"
                               + "<div class='tl'></div><div class='tr'></div>"
                               + "<div class='desc'>"
                               + "<p>Thêm người dùng bị lỗi !</p>"
                               + "</div>"
                               + "<div class='bl'></div><div class='br'></div>"
                               + "</div>";
            }
        }
        else
        {
            lbError.Text = "<div class='error'>"
                           + "<div class='tl'></div><div class='tr'></div>"
                           + "<div class='desc'>"
                           + "<p>Mật khẩu không chính xác !</p>"
                           + "</div>"
                           + "<div class='bl'></div><div class='br'></div>"
                           + "</div>";
        }
    }