protected void btThem_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(curentId)) { // eidt Guid id = Guid.Parse(curentId); TblMauThongBao updatetb = MauThongBaoBussiness.GwtMauThongBaoById(id); if (updatetb != null) { updatetb.TenMauThongBao = txtTen.Text; updatetb.NoiDung = txtNoiDung.Text; updatetb.TrangThai = cbTrangThai.Checked; updatetb.NguoiCapNhat = txtNguoiTao.Text; updatetb.NgayCapNhat = DateTime.Now; updatetb = MauThongBaoBussiness.UpdateMauThongBao(updatetb); } } else { TblMauThongBao tb = new TblMauThongBao(); tb.Id = Guid.NewGuid(); tb.TenMauThongBao = txtTen.Text; tb.NoiDung = txtNoiDung.Text; tb.NgayTao = DateTime.Now; tb.NguoiTao = txtNguoiTao.Text; if (cbTrangThai.Checked) { tb.TrangThai = true; } tb = MauThongBaoBussiness.InsertMauThongBao(tb); } Response.Redirect("ThongBaoView.aspx"); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!string.IsNullOrEmpty(curentId)) { TblMauThongBao tb = MauThongBaoBussiness.GwtMauThongBaoById(curentId); if (tb != null) { txtTen.Text = tb.TenMauThongBao; txtNoiDung.Text = tb.NoiDung; txtNguoiTao.Text = tb.NguoiTao; if (tb.TrangThai == true) { cbTrangThai.Checked = true; } else { cbTrangThai.Checked = false; } } } else { } } }
protected void btnSearch_Click(object sender, EventArgs e) { String a = txtSearch.Text; List <TblMauThongBao> lstThongBao = MauThongBaoBussiness.SearchListMauThongBao(a); nv.DataSource = lstThongBao; nv.DataBind(); }
protected void btnDelete_Click(object sender, EventArgs e) { Button btn = sender as Button; if (btn != null && !string.IsNullOrEmpty(btn.CommandArgument)) { MauThongBaoBussiness.DeleteMauThongBao(btn.CommandArgument); nv.DataBind(); } Response.Redirect("ThongBaoView.aspx"); }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { return; } List <TblMauThongBao> lstThongBao = MauThongBaoBussiness.GetListMauThongBao(); nv.DataSource = lstThongBao; nv.DataBind(); }
private void LoadDDLMauThongBao() { List <TblMauThongBao> lstMauThongBao = MauThongBaoBussiness.GetListMauThongBao(); foreach (var item in lstMauThongBao) { ListItem listItem = new ListItem(); listItem.Text = item.TenMauThongBao; listItem.Value = item.Id.ToString(); ddlMoTa.Items.Add(listItem); } }