protected void Page_Load(object sender, EventArgs e) { if (!Session["User"].Equals("")) { TaiKhoan tkUs = new TaiKhoan(); TaiKhoanBUL tkBUL = new TaiKhoanBUL(); int maNhanDuoc = int.Parse(Convert.ToString(Session["User"])); tkUs = tkBUL.getUserInfo(maNhanDuoc); HyperLink2.Text = "Xin chào: " + tkUs.TenTaiKhoan; HyperLink2.NavigateUrl = "Profile.aspx?Id=" + maNhanDuoc; } }
protected void Page_Load(object sender, EventArgs e) { if (Session["Status"] != "") { TaiKhoan tkUs = new TaiKhoan(); TaiKhoanBUL tkBUL = new TaiKhoanBUL(); int maNhanDuoc = int.Parse(Session["Status"].ToString()); tkUs = tkBUL.getUserInfo(maNhanDuoc); lbTen.Text = tkUs.TenTaiKhoan; } else { Response.Redirect("Login.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { param = int.Parse(Request.QueryString["Id"].ToString()); if (Request.QueryString["Action"].ToString().Equals("Edit")) { //load usercontrol instance = Page.LoadControl("EditForm.ascx"); Panel1.Controls.Add(instance); } else { TaiKhoanBUL tkDel = new TaiKhoanBUL(); tkDel.del(param); Response.Redirect("Admin_Account.aspx"); } }
protected void Button1_Click1(object sender, EventArgs e) { TaiKhoanBUL tkBUL = new TaiKhoanBUL(); if (tkBUL.KiemTraUser(txtUser.Text, txtPass.Text) == true) { Response.Write("<script>alert('Đăng nhập thành công!')</script>"); int ma = tkBUL.getMa(); Session["User"] = ma.ToString(); Response.Redirect("Index.aspx"); } else { string err = tkBUL.getNotification(); Response.Write("<script>alert('" + err + "')</script>"); } }
protected void btnAdd_Click(object sender, EventArgs e) { TaiKhoan taiKhoanThem = new TaiKhoan(); taiKhoanThem.MaTaiKhoan = int.Parse(txtMa.Text); taiKhoanThem.TenTaiKhoan = txtTen.Text; taiKhoanThem.MatKhau = txtPass.Text; taiKhoanThem.QuyenHan = txtRole.Text; taiKhoanThem.TrangThai = drStt.SelectedValue; TaiKhoanBUL tkBULThem = new TaiKhoanBUL(); if (tkBULThem.themUser(taiKhoanThem) == true) { Response.Write("Thêm thành công!"); Response.Redirect("Dasboard.aspx"); } else { Response.Write("Lỗi không thêm được!"); } }
protected void btnLogin_Click(object sender, EventArgs e) { string result = ""; TaiKhoan taiKhoan = new TaiKhoan(); TaiKhoanBUL tkBUL = new TaiKhoanBUL(); taiKhoan.TenTaiKhoan = txtUser.Text; taiKhoan.MatKhau = txtPassword.Text; if (tkBUL.KiemTraDangNhap(taiKhoan.TenTaiKhoan, taiKhoan.MatKhau) == true) { lbResult.Text = "Đăng nhập thành công!"; lbScript.Text = "<script>$('.alert').removeClass('hidden')</script>"; Session["Status"] = tkBUL.getMa().ToString(); Response.Redirect("Dasboard.aspx"); } else { Session["Status"] = ""; result = tkBUL.getNotification(); lbResult.Text = result; lbScript.Text = "<script>$('.alert').removeClass('hidden')</script>"; } }