private void btthem_Click(object sender, EventArgs e) { if (this.txtMaDichVu.TextLength == 0) { MessageBox.Show("Tên Mã Dịch Vụ Không Được Bỏ Trống"); } else if (this.txtTenDichVu.TextLength == 0) { MessageBox.Show("Tên Dịch Vụ Không Được Bỏ Trống"); } else if (isLegalName(txtTenDichVu.Text) == false) { MessageBox.Show("Tên Dịch Vụ Không Được Có Số"); } else if (this.txtDonGia.TextLength == 0) { MessageBox.Show("Đơn Giá Không Được Bỏ Trống"); } else { try { DAO_DichVu.InsertDichVu(new DTO_DichVu(Convert.ToInt32(txtMaDichVu.Text), txtTenDichVu.Text, Convert.ToInt32(txtDonGia.Text))); frmQuanLyDichVu_Load(sender, e); MessageBox.Show("Đã Thêm Thông Tin Thành Công"); } catch { MessageBox.Show(" Thông Tin Đã Tồn Tại "); } } }
public static bool InsertDichVu(DTO_DichVu dichVu) { return(DAO_DichVu.InsertDichVu(dichVu)); }