//them loai san pham public bool themKH(ET_KH sp) { try { _cn.Open(); SqlCommand cmd = new SqlCommand("sp_themKH", _cn); cmd.CommandText = "sp_themKH"; cmd.CommandType = CommandType.StoredProcedure; SqlParameter p_ma = new SqlParameter("@MaKH", sp.Makh); cmd.Parameters.Add(p_ma); SqlParameter p_ten = new SqlParameter("@TenKH", sp.Tenkh); cmd.Parameters.Add(p_ten); SqlParameter p_diachi = new SqlParameter("@DiaChi", sp.Diachi); cmd.Parameters.Add(p_diachi); SqlParameter p_sdt = new SqlParameter("@SDT", sp.Sdt); cmd.Parameters.Add(p_sdt); if (cmd.ExecuteNonQuery() > 0) { return(true); } else { return(false); } } catch (Exception ex) { return(false); } finally { _cn.Close(); } }
private void btnsua_Click(object sender, EventArgs e) { if (txtdiachi.Text != "" && txtma.Text != "" && txtten.Text != "") { ET_KH lsp = new ET_KH(txtma.Text, txtten.Text, txtdiachi.Text, mtbSDT.Text); if (bLSP.SuaKh(lsp) == true) { MessageBox.Show("Sua thanh cong "); } else { MessageBox.Show("Sua khong thanh cong "); } load(); } else { MessageBox.Show("Kiểm Tra Thông Tin Nhập"); } }
public bool SuaKh(ET_KH b) { return(kh.capNhapKH(b)); }
public bool ThemKH(ET_KH b) { return(kh.themKH(b)); }