private void ajouterToolStripMenuItem_Click(object sender, EventArgs e) { List <DataGridViewRow> toDelete = new List <DataGridViewRow>(); foreach (DataGridViewRow row in dgvAttente.SelectedRows) { using (var frm = new frmAjouterNotice()) { frm.txtSearch.Text = row.Cells["ISBN"].Value.ToString(); if (frm.ShowDialog() == DialogResult.OK) { var db = new MongoClient(Properties.Settings.Default.MongoDB).GetDatabase("wfBiblio"); ObjectId id = (ObjectId)row.Cells["_id"].Value; Notice notice = db.GetCollection <Notice>("NoticeAttente").Find(_ => _._id == id).FirstOrDefault(); // Remplacer par l'id d'exemplaire crée manuellement notice.exemplaires = frm.m_lastNotice.exemplaires; IntegrerEmprunt(notice); db.GetCollection <Notice>("NoticeAttente").DeleteOne(_ => _._id == id); toDelete.Add(row); AddLog($"Notice ajoutée {notice.isbn} => {notice.titre} - {notice.auteur}"); } } } foreach (DataGridViewRow row in toDelete) { dgvAttente.Rows.Remove(row); } }
private void btnAddNotice_Click(object sender, EventArgs e) { using (var frm = new frmAjouterNotice()) { if (frm.ShowDialog() == DialogResult.OK) { dgvResultNotice.DataSource = new List <Notice>() { frm.m_lastNotice }; dgvResultNotice.AutoResizeColumns(); } } }
private void btnAddNotice_Click(object sender, EventArgs e) { using (var frm = new frmAjouterNotice()) frm.ShowDialog(); }