//them loai san pham public bool themLoaiSP(ET_LoaiSP sp) { try { _cn.Open(); SqlCommand cmd = new SqlCommand("sp_themLoaiSP", _cn); cmd.CommandText = "sp_themLoaiSP"; cmd.CommandType = CommandType.StoredProcedure; SqlParameter p_ma = new SqlParameter("@MaLoaiSP", sp.MaTL); cmd.Parameters.Add(p_ma); SqlParameter p_ten = new SqlParameter("@TenLoaiSP", sp.TenTL); cmd.Parameters.Add(p_ten); if (cmd.ExecuteNonQuery() > 0) { return(true); } else { return(false); } } catch (Exception ex) { return(false); } finally { _cn.Close(); } }
private void btnCapNhat_Click(object sender, EventArgs e) { if (txtMa.Text != "" && txtTen.Text != "") { ET_LoaiSP lsp = new ET_LoaiSP(txtMa.Text, txtTen.Text); if (bLSP.SuaLSP(lsp) == true) { MessageBox.Show("Sua thanh cong "); } else { MessageBox.Show("Sua khong thanh cong "); } load(); } else { MessageBox.Show("Kiểm tra lại thông tin nhập"); } }
private void btnThem_Click(object sender, EventArgs e) { if (txtMa.Text != "" && txtTen.Text != "") { ET_LoaiSP lsp = new ET_LoaiSP(txtMa.Text, txtTen.Text); if (bLSP.ThemLSP(lsp) == true) { MessageBox.Show("Them thanh cong "); txtMa.Text = ""; txtTen.Text = ""; } else { MessageBox.Show("Them khong thanh cong "); } load(); } else { MessageBox.Show("Kiểm tra thông tin nhập"); } }
public bool SuaLSP(ET_LoaiSP b) { return(loaiSP.capNhapLoaiSP(b)); }
public bool ThemLSP(ET_LoaiSP b) { return(loaiSP.themLoaiSP(b)); }