示例#1
0
        protected void btnRegister_Click(object sender, EventArgs e)
        {
            if (usernameRegister.Text.Trim() == "")
            {
                Response.Write("<script>alert('Bạn phải nhập tên đăng nhập');</script>");
                return;
            }
            String tenDangNhap = usernameRegister.Text;

            String email = emailRegister.Text;

            if (email == "")
            {
                Response.Write("<script>alert('Bạn phải nhập email');</script>");
                return;
            }
            if (passwordRegister.Text == "")
            {
                Response.Write("<script>alert('Bạn phải nhập mật khẩu');</script>");
                return;
            }
            if (passwordRegister.Text != confirmPasswordRegister.Text)
            {
                Response.Write("<script>alert('Mật khẩu không khớp');</script>");
            }
            Travel.Entities.KhachHang kh = new Entities.KhachHang();
            kh.TenDangNhap = tenDangNhap;
            kh.Email       = email;
            kh.MatKhau     = passwordRegister.Text;
            if (obj.KhachHang_Insert(kh))
            {
                Response.Write("<script>alert('Đăng kí thành công. Hãy đăng nhập');</script>");
            }
            else
            {
                Response.Write("<script>alert('Lỗi đăng kí');</script>");
            }
        }
示例#2
0
 private void LoadData()
 {
     try
     {
         string user = (string)Session["KhachHang_Login"];
         if (user == null)
         {
             Response.Redirect("404.aspx");
             return;
         }
         kh = obj.KhachHang_GetByTop("", "TenDangNhap = '" + user + "'", "").ElementAt(0);
         if (kh.HoTen != null)
         {
             HoTen.Text = kh.HoTen;
         }
         if (kh.Email != null)
         {
             EmailAddress.Text = kh.Email;
         }
         if (kh.DienThoai != null)
         {
             DienThoai.Text = kh.DienThoai;
         }
         if (kh.DiaChi != null)
         {
             DiaChi.Text = kh.DiaChi;
         }
         if (kh.TenDangNhap != null)
         {
             TenDangNhap.Text = kh.TenDangNhap;
         }
     }
     catch
     {
         kh = null;
     }
 }