private void btnAdd_Click(object sender, EventArgs e) { DataSetTpos.contragentRow crRow = DBclass.DS.contragent.NewcontragentRow(); ContragentForm contragentForm = new ContragentForm(crRow, false); if (contragentForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { DBclass.DS.contragent.AddcontragentRow(crRow); updateContragent(); //FormCloseOK(DBclass.DS.contragent.Rows[DBclass.DS.contragent.Rows.Count - 1]["contragentId"].ToString()); } }
private void dgvContagent_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { int contrId = (int)dgvContagent.Rows[e.RowIndex].Cells["contragentId"].Value; DataSetTpos.contragentRow crRow = DBclass.DS.contragent.Single <DataSetTpos.contragentRow>(crId => crId.contragentId == contrId); ContragentForm contForm = new ContragentForm(crRow, true); if (contForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { //DBclass.DS.contragent.AddcontragentRow(crRow); updateContragent(); } } }