/** * @param phieuMuonChiTiet */ public void ThemPhieuMuonChiTiet(PhieuMuonChiTietDTO phieuMuonChiTiet) { querry = "insert PhieuMuonChiTieu values(@MaPhieuMuon,@MaTaiLieu,@SoLuongMuon,@NgayTra)"; connection.Open(); command = new SqlCommand(querry, connection.sqlConnection); command.Parameters.AddWithValue("MaPhieuMuon", phieuMuonChiTiet.MaPhieuMuon); command.Parameters.AddWithValue("MaTaiLieu", phieuMuonChiTiet.MaSach); command.Parameters.AddWithValue("SoLuongMuon", phieuMuonChiTiet.SoLuongMuon); command.Parameters.AddWithValue("NgayTra", phieuMuonChiTiet.NgayTra); command.ExecuteNonQuery(); connection.Close(); // TODO implement here // TODO implement here }
/** * @param phieuMuonChiTiet */ public void SuaPhieuMuonChiTiet(PhieuMuonChiTietDTO phieuMuonChiTiet) { querry = "update PhieuMuonChiTieu set MaTaiLieu=@MaTaiLieu,SoLuongMuon=@SoLuongMuon,NgayTra=@NgayTra where MaPhieuMuon=@MaPhieuMuon"; connection.Open(); command = new SqlCommand(querry, connection.sqlConnection); command.Parameters.AddWithValue("MaPhieuMuon", phieuMuonChiTiet.MaPhieuMuon); command.Parameters.AddWithValue("MaTaiLieu", phieuMuonChiTiet.MaSach); command.Parameters.AddWithValue("SoLuongMuon", phieuMuonChiTiet.SoLuongMuon); command.Parameters.AddWithValue("NgayTra", phieuMuonChiTiet.NgayTra); command.ExecuteNonQuery(); // TODO implement here connection.Close(); // TODO implement here // TODO implement here }
public bool them(PhieuMuonChiTietDTO item) { try { con.Open(); SqlCommand cmd = new SqlCommand("INSERT INTO PhieuMuonChiTiet VALUES(@maphieu, @matl, @sl, @ngaytra)",con); cmd.Parameters.AddWithValue("maphieu", item.MaPhieuMuon); cmd.Parameters.AddWithValue("matl", item.MaTaiLieu); cmd.Parameters.AddWithValue("sl", item.SoLuongMuon); cmd.Parameters.AddWithValue("ngaytra", SqlDateTime.Null); if (cmd.ExecuteNonQuery() > 0) return true; } catch(Exception ex) { } finally { con.Close(); } return false; }
private void butLuu_Click(object sender, EventArgs e) { PhieuMuonDTO i_pm = new PhieuMuonDTO(texMaPhieuMuon.Text.ToString(), texMaDocGia.Text.ToString(), Convert.ToDateTime(dao_ngaymuon()), texMaNhanVien.Text.ToString()); myPhieuMuonBUL.them(i_pm); int lc = listview1.Items.Count; for (int i = 0; i < lc; i++) { PhieuMuonChiTietDTO i_pmct = new PhieuMuonChiTietDTO(texMaPhieuMuon.Text.ToString(), listview1.Items[i].SubItems[0].Text.ToString(), Convert.ToInt32(listview1.Items[i].SubItems[2].Text.ToString()), DateTime.Now); myPhieuMuonChiTietBUL.them(i_pmct); int sl_bd = Convert.ToInt32(myTaiLieuBUL.getthongtinSLTL(listview1.Items[i].SubItems[0].Text.ToString())); int sl_lay = Convert.ToInt32(listview1.Items[i].SubItems[2].Text.ToString()); int sl_con = sl_bd - sl_lay; myTaiLieuBUL.up_sl(sl_con, listview1.Items[i].SubItems[0].Text.ToString()); } MessageBox.Show("Mượn Tài Liệu Thành Công", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); clear(); ////// /// texMaPhieuMuon.Text = maTuTang(); texNgayMuon.Text = ngayMuon(); cboxTenTaiLieu.DataSource = myTaiLieuBUL.getTaiLieu(); cboxTenTaiLieu.DisplayMember = "TenTaiLieu"; cboxTenTaiLieu.ValueMember = "MaTaiLieu"; texMaTaiLieu.Text = ""; cboxTenTaiLieu.SelectedIndex = -1; texSoLuongCon.Clear(); cboxSoLuongMuon.SelectedIndex = -1; butDK.Enabled = false; butLuu.Enabled = false; butHuy.Enabled = false; groupBoxTimTaiLieu.Enabled = false; listview1.Enabled = false; dgv.Enabled = false; texMaDocGia.Select(); }
/** * @param phieuMuonChiTietDAO */ public void SuaPhieuMuonChiTiet(PhieuMuonChiTietDTO phieuMuonChiTietDTO) { phieuMuonChiTietDAO.SuaPhieuMuonChiTiet(phieuMuonChiTietDTO); // TODO implement here }
public bool them(PhieuMuonChiTietDTO item) { return(myPhieuMuonChiTietDAL.them(item)); }