protected void submit_edit_Click(object sender, EventArgs e) { int id = Convert.ToInt32(hidden_id.Value); DanhMucNoiNgoaiThat cate = new DanhMucNoiNgoaiThat(); cate.TenDanhMuc = txtTenDanhMuc_edit.Text; cate.MoTa = txtMoTa_edit.Text; cate.status = checkStatus_edit.Checked;; obj.update(cate, id); //load list Response.Redirect(Request.Url.ToString()); }
protected void submit_create_Click(object sender, EventArgs e) { //kiem tra trong if (txtMoTa_create.Text == "" || txtTenDanhMuc_create.Text == "") { ClientScript.RegisterStartupScript(this.GetType(), "vanh", "blank()", true); return; } //them DanhMucNoiNgoaiThat cate1 = new DanhMucNoiNgoaiThat(); cate1.TenDanhMuc = txtTenDanhMuc_create.Text; cate1.MoTa = txtMoTa_create.Text; /*cate.status = true; * if (!checkStatus_create.Checked) cate.status = false;*/ cate1.status = checkStatus_create.Checked; cate1.created_at = DateTime.Now; obj.create(cate1); //load list Response.Redirect(Request.Url.ToString()); }
public void update(DanhMucNoiNgoaiThat c, int id) { string sql = "update tbl_DanhMucNoiNgoaiThat set TenDanhMuc = N'" + c.TenDanhMuc + "', MoTa = N'" + c.MoTa + "', status = '" + c.status + "' where id = '" + id + "'"; obj.ExecuteNonQuery(sql); }
public void create(DanhMucNoiNgoaiThat c) { string sql = "insert tbl_DanhMucNoiNgoaiThat values(N'" + c.TenDanhMuc + "' , N'" + c.MoTa + "', '" + c.status + "', '" + c.created_at + "' )"; obj.ExecuteNonQuery(sql); }