private void createToolStripMenuItem_Click(object sender, EventArgs e) { try { cao = cao ?? new Remoting.Client.ClientActivated(); int id = wko.Count + cao.ChangeTransaction.Length + 1; RecordDataEditor f = new RecordDataEditor(new RecordDataObject(id, string.Empty, DateTime.Now)); f.ShowDialog(); Data.Add(f.o); Update(); cao.CreateRecord(f.o); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void updateToolStripMenuItem_Click(object sender, EventArgs e) { try { if (rdoView.SelectedRows.Count == 0) { throw new Exception("Выбирите строку"); } cao = cao ?? new Remoting.Client.ClientActivated(); RecordDataObject r = rdoView.SelectedRows[0].DataBoundItem as RecordDataObject; RecordDataObject old = new RecordDataObject(r); RecordDataEditor f = new RecordDataEditor(r); f.ShowDialog(); Data.Where(w => w.id == f.o.id).Select(s => s = f.o).ToList(); Update(); cao.UpdateRecord(old, f.o); } catch (Exception ex) { MessageBox.Show(ex.Message); } }