private void butluu_Click(object sender, EventArgs e) { if (txtma.Text == "" || txtten.Text == "") { MessageBox.Show("Chưa nhập đủ thông tin"); return; } Nxb n = new Nxb(); n.manxb = txtma.Text; n.tennxb = txtten.Text; n.diachi = txtdc.Text; if (MessageBox.Show(string.Format("lưu nhà xuất bản đi "), "", MessageBoxButtons.OKCancel) == DialogResult.OK) { if (Bus.InsertProfile(n) > 0) { MessageBox.Show("Đã lưu rồi nhé"); nhaxuatban_Load(sender, e); } else { MessageBox.Show("lỗi rồi à"); } } }
private void butxoa_Click(object sender, EventArgs e) { if (txtma.Text == "" || txtten.Text == "") { MessageBox.Show("Chưa chọn thông tin"); return; } Nxb n = new Nxb(); n.manxb = txtma.Text; n.tennxb = txtten.Text; n.diachi = txtdc.Text; if (MessageBox.Show(string.Format("Xóa nhà xuất bản"), "", MessageBoxButtons.OKCancel) == DialogResult.OK) { if (Bus.DeleteProfile(n) > 0) { MessageBox.Show("Đã xóa"); nhaxuatban_Load(sender, e); } else { MessageBox.Show("sai rồi xóa sao duoc"); } } }
private void butsua_Click(object sender, EventArgs e) { if (txtma.Text == "" || txtten.Text == "") { MessageBox.Show("Chưa nhập đủ thông tin"); return; } Nxb n = new Nxb(); n.manxb = txtma.Text; n.tennxb = txtten.Text; n.diachi = txtdc.Text; if (MessageBox.Show(string.Format("sửa nxb"), "", MessageBoxButtons.OKCancel) == DialogResult.OK) { if (Bus.UpdateProfile(n) > 0) { MessageBox.Show("Đã sửa"); nhaxuatban_Load(sender, e); } else { MessageBox.Show("Thông tin chưa được sửa"); } } }
public static int DeleteProfile(Nxb n) { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@ma", n.manxb), new SqlParameter("@ten", n.tennxb) }; return(DataProvider.ExecuteNonQuery("xoaNXB", para)); }
public static int InsertProfile(Nxb n) { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@ma", n.manxb), new SqlParameter("@ten", n.tennxb), new SqlParameter("@diachi", n.diachi) }; return(DataProvider.ExecuteNonQuery("themNXB", para)); }
public static int DeleteProfile(Nxb n) { return(Dao.DeleteProfile(n)); }
public static int UpdateProfile(Nxb n) { return(Dao.UpdateProfile(n)); }
public static int InsertProfile(Nxb n) { return(Dao.InsertProfile(n)); }