private void BtThem_Click(object sender, EventArgs e) { PhieuTra_DTO pm = new PhieuTra_DTO(); if (txtMP.Text != "" && cbMDG.Text != "" && cbMS.Text != "") { pm.MaDocGia = cbMDG.Text; pm.MaPhieu = txtMP.Text; pm.MaSach = cbMS.Text; pm.NgayTra = dtTra.Value; int check = traBUS.ThemT(pm); if (check == 0) { MessageBox.Show("Thêm không thành công"); } else if (check == -1) { MessageBox.Show("Thêm thành công"); } Reset(sender, e); PhieuTra_Load(sender, e); } else { MessageBox.Show("Chưa nhập đủ thông tin"); } }
public void Sua(PhieuTra_DTO pm) { string sql = string.Format("update PHIEUTRA set MaDocGia = '{0}', MaSach = '{1}', NgayTra = '{2}' where MaPhieu = '{3}' ", pm.MaDocGia, pm.MaSach, pm.NgayTra, pm.MaPhieu); Excute(sql); }
public bool KiemTra(PhieuTra_DTO p) { if (p.MaPhieuTra == "" || p.MaThe == "" || p.MaThuThu == "" || p.NgayTra == "") { return(false); } return(true); }
public bool SuaT(PhieuTra_DTO pm) { if (string.IsNullOrEmpty(pm.MaPhieu)) { return(false); } tDao.Sua(pm); return(true); }
public frm_TraSach() { InitializeComponent(); phieuPhatDTO = new PhieuPhat_DTO(); phieuPhatBUS = new PhieuPhat_BUS(); phieuTraBUS = new PhieuTra_BUS(); phieuTraDTO = new PhieuTra_DTO(); ctTraSachBUS = new ChiTietTraSach_BUS(); ctTraSachDTO = new ChiTietTraSach_DTO(); }
public int ThemT(PhieuTra_DTO pm) { if (string.IsNullOrEmpty(pm.MaPhieu)) { return(0); } if (!tDao.Them(pm)) { return(-1); } return(1); }
public bool Them(PhieuTra_DTO pm) { if (GetData("select* from PHIEUTRA where MaPhieu = '" + pm.MaPhieu + "'").Rows.Count > 0) { return(false); } string sql = "insert into PHIEUTRA (MaPhieu, MaDocGia, MaSach, NgayTra ) values('" + pm.MaPhieu + "','" + pm.MaDocGia + "','" + pm.MaSach + "','" + pm.NgayTra + "')"; Excute(sql); return(true); }
public bool Insert(PhieuTra_DTO t) { try { if (con.State == ConnectionState.Closed) { con.Open(); } string sqlQuery = @" Insert into PHIEUTRA (MaPhieuTra, MaThe, MaThuThu,NgayTra, SoLuong) values (N'" + t.MaPhieuTra + "',N'" + t.MaThe + "',N'" + t.MaThuThu + "',N'" + t.NgayTra + "',0 )"; SqlCommand cmd = new SqlCommand(sqlQuery, con); cmd.ExecuteNonQuery(); con.Close(); return(true); } catch { return(false); } }
private void BtnSua_Click(object sender, EventArgs e) { PhieuTra_DTO s = new PhieuTra_DTO(); if (txtMP.Text == "") { MessageBox.Show("Phải nhập mã phiếu muốn sửa!!!"); txtMP.Focus(); } else { s.MaPhieu = txtMP.Text; } if (txtMP.Text == "" || cbMDG.Text == "" || cbMS.Text == "") { MessageBox.Show("Phải nhập đầy đủ thông tin"); } else { s.MaDocGia = cbMDG.Text; s.MaPhieu = txtMP.Text; s.MaSach = cbMS.Text; s.NgayTra = dtTra.Value; if (!traBUS.SuaT(s)) { MessageBox.Show("Sửa không thành công!!!"); } else { MessageBox.Show("Sửa thành công"); } Reset(sender, e); PhieuTra_Load(sender, e); } }
public bool Insert(PhieuTra_DTO p) { return(phieuTraDAL.Insert(p)); }