protected void btnGui_Click(object sender, EventArgs e) { lienheBLL bs = new lienheBLL(); bs.addLienHe(txtHoTen.Text.Trim(), txtDiaChi.Text.Trim(), txtEmail.Text.Trim(), txtSDT.Text.Trim(), txtNoiDung.Text.Trim()); Response.Redirect("lienhes.aspx"); }
// load thong tin private void ttChitiet() { int id = Convert.ToInt32(Request.QueryString["id"]); lienheBLL bs = new lienheBLL(); List <lienheDAL> ds = bs.getLienHebyId(id); lbEmail.Text = ds[0].email; lbHoTen.Text = ds[0].hoten; lbNgayGui.Text = ds[0].ngaygui.ToString(); lbNoidung.Text = ds[0].noidung; lbSDT.Text = ds[0].sdt; }
private void loadLienHe() { int row = 10; int hide = 0; if (Request.QueryString["p"] != null) { hide = Convert.ToInt32(Request.QueryString["p"]); } lienheBLL bs = new lienheBLL(); List <lienheDAL> list = bs.getLienHeP(row, hide); rpLienHe.DataSource = list; rpLienHe.DataBind(); List <userpublicDAL> us = (List <userpublicDAL>)Session["adminuser"]; int id_user = us[0].id_user; lienheviewBLL b = new lienheviewBLL(); List <lienheDAL> ds = b.lienhe_view(id_user); for (int i = 0; i <= list.Count - 1; i++) { Label lbSTT = rpLienHe.Items[i].FindControl("lbSTT") as Label; lbSTT.Text = (hide + i + 1).ToString(); Label lbView = rpLienHe.Items[i].FindControl("lbview") as Label; if (check(list[i].id_lienhe) == true) { // lbView.Visible = false; lbView.Text = "[Đã xem]"; } else { lbView.Visible = true; } } // phan trang: int current = Convert.ToInt32(Request.QueryString["p"]); phantrang pt = new phantrang(); lbPage.Text = pt.paging(bs.countP(), row, "", current); }
protected void btnUpDate_Click(object sender, EventArgs e) { lienheBLL bs = new lienheBLL(); lienheviewBLL bss = new lienheviewBLL(); string id = ""; int lengh = 0; bool tf = false; bool tff = false; bool check = false; for (int i = 0; i <= rpLienHe.Items.Count - 1; i++) { CheckBox cbDell = rpLienHe.Items[i].FindControl("cbDell") as CheckBox; if (cbDell.Checked) { id += cbDell.ToolTip + ","; check = true; } } lengh = id.Length; if (check == true) { string hid = id.Remove(lengh - 1); tff = bss.del(hid); tf = bs.del(hid); if (tff == true && tf == true) { Response.Redirect("lienhe.aspx?up=t"); } else { lbError.Text = "<div class='error'> " + " <div class='tl'></div><div class='tr'></div>" + "<div class='desc'>" + " <p>Cập nhật thất bại!</p>" + "</div>" + "<div class='bl'></div><div class='br'></div>" + "</div>"; } } }