private void btn_tt_x_Click(object sender, EventArgs e) { thuthu_DTO tt = new thuthu_DTO(); tt.matt = txb_tt_mtt.Text; tt.tentt = txb_tt_ttt.Text; tt.diachi = txb_tt_dc.Text; tt.gt = txb_tt_gt.Text; tt.sdt = txb_tt_sdt.Text; int check = tt_bus.xoa(tt); try { if (check == 0) { MessageBox.Show("Mời nhập mã thủ thư muốn xóa", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (check == -1) { MessageBox.Show("Mã thủ thư không tồn tại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (check == 1) { Urc_thuthu_Load(sender, e); } } catch (Exception ex) { MessageBox.Show("Lỗi", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } txb_tt_mtt.Text = ""; }
public bool xoatt(thuthu_DTO tt) { if (getdata("select * from Thu_Thu where MaTT=N'" + tt.matt + "'").Rows.Count == 0) { return(false); } string sql = string.Format("dbo.delete_thuthu N'{0}'", tt.matt); Execute(sql); return(true); }
public bool suatt(thuthu_DTO tt) { if (getdata("select * from Thu_Thu where MaTT=N'" + tt.matt + "'").Rows.Count == 0) { return(false); } string sql = string.Format("dbo.update_thuthu N'{0}', N'{1}', N'{2}', N'{3}', N'{4}'", tt.matt, tt.tentt, tt.diachi, tt.gt, tt.sdt); Execute(sql); return(true); }
public int xoa(thuthu_DTO tt) { if (string.IsNullOrEmpty(tt.matt)) { return(0); } if (tt_dal.xoatt(tt) == false) { return(-1); } return(1); }
public int sua(thuthu_DTO tt) { if (string.IsNullOrEmpty(tt.matt) || string.IsNullOrEmpty(tt.tentt) || string.IsNullOrEmpty(tt.diachi) || string.IsNullOrEmpty(tt.gt) || string.IsNullOrEmpty(tt.sdt)) { return(0); } if (tt_dal.suatt(tt) == false) { return(-1); } return(1); }