private void tbs_edit_Click(object sender, EventArgs e) { if (txt_mathietbi.Text == "") { MessageBox.Show("Dữ liệu chưa được nhập."); return; } thietbi t = new thietbi(); t.maloaithietbi = cmb_maloai.SelectedValue.ToString(); t.mathietbi = txt_mathietbi.Text; t.tenthietbi = txt_tenthietbi.Text; t.giathietbi = int.Parse(txt_giathietbi.Text.ToString()); t.tinhtrang = txt_tinhtrang.Text; if (MessageBox.Show(string.Format("Bạn có muốn sửa thiết bị ?"), "", MessageBoxButtons.OKCancel) == DialogResult.OK) { if (Bus.UpdateProfile(t) > 0) { MessageBox.Show("Thao tác đã được thực hiện."); Thietbi_Load(sender, e); } } else { MessageBox.Show("Lỗi!"); } }
private void tbs_delete_Click(object sender, EventArgs e) { if (txt_mathietbi.Text == "") { MessageBox.Show("Dữ liệu chưa được chọn."); } thietbi t = new thietbi(); t.mathietbi = txt_mathietbi.Text; t.tenthietbi = txt_tenthietbi.Text; t.maloaithietbi = cmb_maloai.SelectedValue.ToString(); t.giathietbi = int.Parse(txt_giathietbi.Text.ToString()); t.tinhtrang = txt_tinhtrang.Text; if (MessageBox.Show(string.Format("Bạn có muốn xóa thiết bị ?"), "", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult) { if (Bus.DeleteProfile(t) > 0) { MessageBox.Show("Thực hiện thành công!"); Thietbi_Load(sender, e); } else { MessageBox.Show("Lỗi."); } } }
public static int DeleteProfile(thietbi t) { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@mathietbi", t.mathietbi) }; return(DataProvider.ExecuteNonQuery("xoathietbi", para)); }
public static int UpdateProfile(thietbi t) { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@mathietbi", t.mathietbi), new SqlParameter("@gia", t.giathietbi) }; return(DataProvider.ExecuteNonQuery("suathietbi", para)); }
//THIẾT BỊ #region public static int InsertProfile(thietbi t) { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@mathietbi", t.mathietbi), new SqlParameter("@tenthietbi", t.tenthietbi), new SqlParameter("@maloai", t.maloaithietbi), new SqlParameter("@gia", t.giathietbi) }; return(DataProvider.ExecuteNonQuery("themthietbi", para)); }
public static int DeleteProfile(thietbi t) { return(Dao.DeleteProfile(t)); }
public static int UpdateProfile(thietbi t) { return(Dao.UpdateProfile(t)); }
// THIẾT BỊ #region public static int InsertProfile(thietbi t) { return(Dao.InsertProfile(t)); }