public int nhapCTP(PhieuSachDTO p, CTPhieuDTO c) { try { return ctpDAL.nhapCTP(p,c); } catch (SqlException ex) { throw ex; } }
public int nhapCTP(PhieuSachDTO p,CTPhieuDTO c) { try { connect = new ConnectionData(); int Nparamater = 2; string[] name = new string[Nparamater]; object[] value = new object[Nparamater]; name[0] = "@MaDG"; value[0] = p.MaDG; name[1] = "@MaSach"; value[1] = c.MaSach; return connect.UpdateData("CTPhieu_Insert", name, value, Nparamater); } catch (Exception) { throw; } }
private void btnMuon_Click(object sender, EventArgs e) { psDTO = new PhieuSachDTO(); psDTO.MaDG = ("" + txtMaDG.Text.ToString().Trim() + ""); psBLL.ChoMuonSach(psDTO); txtHoTenDG.Text = psDTO.MaPhieu; ctpBLL = new CTPhieuBLL(); for (int j = 0; j < grdThemSach.RowCount; j++) { CTPhieuDTO t = new CTPhieuDTO(); t.MaSach = grdThemSach.GetRowCellValue(j, "MaSach").ToString(); ctpBLL.nhapCTP(psDTO, t); } dtS.Clear(); loadUC(); i = 0; XtraMessageBox.Show("Lập phiếu mượn thành công!"); }