private void btnAddPayment_Click(object sender, EventArgs e) { var form = new AddPayment(); form.AddNewPayment(_contractId); if (form.ShowDialog(this) == DialogResult.OK) { DataAccess pa = new DataAccess(); var tempContr = pa.GetContractById(_contractId); tempContr.NoOfInstallments = tempContr.NoOfInstallments + 1; txtInstallments.Text = tempContr.NoOfInstallments.ToString(); pa.Update(); } }
private void paymentGrid_MouseDoubleClick(object sender, MouseEventArgs e) { int payemtId = 0; if (paymentGrid.SelectedRows.Count > 0) { var row = paymentGrid.SelectedRows[0]; payemtId = ((dynamic)row.DataBoundItem).Id; } var form = new AddPayment(); form.EditPayment(payemtId); if (form.ShowDialog(this) == DialogResult.OK) { DataAccess pa = new DataAccess(); paymentGrid.DataSource = pa.GetPaymentByContractId(contract.Id); //todo: noting } }