private void btnOkSua_Click(object sender, EventArgs e) { if ((txtMaNXB.Text != "") && (txtTenNXB.Text != "")) { try { NXB_DTO nxb = new NXB_DTO(txtMaNXB.Text, txtTenNXB.Text, rtbThongTinNXB.Text); BUS_OBJ.suaNXB(nxb); HienThiDuLieu(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { btnCancel_Click(sender, e); //if (conn.State == ConnectionState.Open) conn.Close(); } } else { MetroFramework.MetroMessageBox.Show(this, "Nhập thiếu dữ liệu.", "Lỗi.", MessageBoxButtons.OK, MessageBoxIcon.Warning); if (txtTenNXB.Text == "") { txtTenNXB.Focus(); } if (txtMaNXB.Text == "") { txtMaNXB.Focus(); } } }
public static void suaNXB(NXB_DTO nXB) { SqlConnection conn = SQLConn.connect(); SqlCommand cmd = new SqlCommand("sp_suanxb", conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@manxb", SqlDbType.VarChar).Value = nXB.MaNXB; cmd.Parameters.Add("@tennxb", SqlDbType.NVarChar).Value = nXB.TenNXB; cmd.Parameters.Add("@ghichu", SqlDbType.NVarChar).Value = nXB.GhiChu; conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); }
public static void suaNXB(NXB_DTO nXB) { Sach_DAO.suaNXB(nXB); }
public static void themNXB(NXB_DTO nXB) { Sach_DAO.themNXB(nXB); }