public void Delete(int idInstraction) { Instraction instraction = getItem(idInstraction); list.Remove(instraction); instraction.Delete(); }
public void Add(Instraction instraction) { if (list.Exists(item => item == instraction)) { return; } list.Add(instraction); }
protected override void LoadFromSql() { DataTable dt = Provider.Select("Instraction"); foreach (DataRow row in dt.Rows) { Instraction instraction = new Instraction(row); Add(instraction); } }
private void FillInstraction() { InstractionList instractionList = InstractionList.getInstance(); Instraction instraction = instractionList.getItem(_driver); if (instraction != null) { instractionInfo.Text = instraction.ToString(); } }
private void LoadData() { dgvInstractions.DataSource = instractionList.ToDataTable(_driver); dgvInstractions.Columns[0].Visible = false; foreach (DataGridViewRow row in dgvInstractions.Rows) { int id = 0; int.TryParse(row.Cells[0].Value.ToString(), out id); Instraction instraction = instractionList.getItem(id); if (instraction.File != string.Empty) { row.DefaultCellStyle.BackColor = BBColors.bbGreen3; } } }
private void dgvInstractions_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (isCellNoHeader(e.RowIndex)) { int idInstraction = Convert.ToInt32(dgvInstractions.Rows[e.RowIndex].Cells[0].Value); Instraction instraction = instractionList.getItem(idInstraction); if ((dgvInstractions.Columns[e.ColumnIndex].HeaderText == "Номер") && (instraction.File != string.Empty)) { WorkWithFiles.openFile(instraction.File); } else { Instraction_AddEdit instAE = new Instraction_AddEdit(instraction); if (instAE.ShowDialog() == System.Windows.Forms.DialogResult.OK) { LoadData(); } } } }
public Instraction_AddEdit(Instraction instraction) { InitializeComponent(); _instraction = instraction; }