public int Update(DTO_Publisher publisher) { string sql = "UPDATE Publisher SET publisher_name = N'" + publisher.Publisher_name + "', publisher_address = N'" + publisher.Publisher_address + "' WHERE publisher_id = '" + publisher.Publisher_id + "';"; return(this.ExecuteNonQuery(sql)); }
public int Insert(DTO_Publisher publisher) { string sql = "INSERT INTO Publisher(publisher_id, publisher_name, publisher_address)" + " VALUES('" + publisher.Publisher_id + "',N'" + publisher.Publisher_name + "',N'" + publisher.Publisher_address + "');"; return(this.ExecuteNonQuery(sql)); }
public int InsertPublisher(DTO_Publisher publisher) { if (publisher.Publisher_name.Contains("'")) { publisher.Publisher_name = checkString(publisher.Publisher_name); } return(publisherDAO.Insert(publisher)); }
public int DeletePublisher(DTO_Publisher publisher) { try { if (publisher.Publisher_name.Contains("'")) { publisher.Publisher_name = checkString(publisher.Publisher_name); } return(publisherDAO.Delete(publisher.Publisher_name)); } catch (Exception) { return(-1); } }
private void btnAdd_Click(object sender, EventArgs e) { if (checkNull()) { DTO_Publisher b = new DTO_Publisher(); b.Publisher_id = int.Parse(txtPublisherID.Text); b.Publisher_name = txtPublisherName.Text; b.Publisher_address = txtAddress.Text; if (bus_publisher.InsertPublisher(b) == 1) { MessageBox.Show("Thành công"); frmPublisher_Load(sender, e); } else { MessageBox.Show("Không thành công"); } } else { MessageBox.Show("Hãy nhập đủ thông tin"); } }
private void btnSeach_Click(object sender, EventArgs e) { if (txtPublisherID.Text != "") { DTO_Publisher dto_publisher = new DTO_Publisher(); String id = txtPublisherID.Text; dto_publisher = bus_publisher.SearchPublisher("publisher_id", txtPublisherID.Text); if (dto_publisher != null) { txtPublisherName.Text = dto_publisher.Publisher_name; txtAddress.Text = dto_publisher.Publisher_address; } else { MessageBox.Show("Không tìm thấy!"); txtPublisherID.Text = ""; } } else { MessageBox.Show("Hãy nhập mã sách cần tìm!"); } }