private void deleteHistoryRecord_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { int selectedRow = dataGridView1.SelectedCells[0].RowIndex; PatientHistoryRecord remPatHistRecElem = dataGridView1.Rows[selectedRow].DataBoundItem as PatientHistoryRecord; if (Notificator.ShowActionConfirmation("Ви впевнені, що хочете цей запис?") != System.Windows.Forms.DialogResult.Yes) { return; } // Если мы удаляем из списка новосозданых элементов - помечам его отрицательным ID (чтобы найти) if (remPatHistRecElem.Id == 0) { remPatHistRecElem.Id = -1; addPatHistList.Remove(remPatHistRecElem); } else { editPatHistList.Remove(remPatHistRecElem); remPatHistList.Add(remPatHistRecElem); } dataGridView1.Rows.RemoveAt(selectedRow); dataGridView1.Refresh(); }
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (formIsInialized) { PatientHistoryRecord rec = medicamentMovementTable.Rows[e.RowIndex].DataBoundItem as PatientHistoryRecord; if (rec.Id > 0) { editPatHistList.Add(rec); } } }
private void button1_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(histRecMsg.Text)) { Notificator.ShowError("Введіть текст запису"); return; } PatientHistoryRecord newPatHistRec = new PatientHistoryRecord(); newPatHistRec.Description = histRecMsg.Text; newPatHistRec.RecordDate = histRecDate.Value; patientHistoryRecordsList.Add(newPatHistRec); addPatHistList.Add(newPatHistRec); if (dbRecord.Id > 0) { newPatHistRec.PatientId = dbRecord.Id; } dataGridView1.Refresh(); }