private void button1_Click(object sender, EventArgs e) { InstallmentsAE f = new InstallmentsAE(); f.rol = 0; f.id = Id1; f.ShowDialog(); MyFormLoad(); }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { Guid id = Guid.Parse(dataGridView1.Rows[e.RowIndex].Cells["Id"].Value.ToString()); InstallementsService.InstallementsServiceClient a = new InstallementsService.InstallementsServiceClient(); if (e.ColumnIndex == 0) // Edit mode { InstallmentsAE f = new InstallmentsAE(); f.id = Id1; f.idIns = id; f.rol = 1; f.ShowDialog(); a = new InstallementsService.InstallementsServiceClient(); dataGridView1.DataSource = a.GetLoanInstallements(Id1).Select(x => new { x.Id, x.Amount, x.PaymentDate, x.IsPayed }).ToList(); MyFormLoad(); //InstallmentsAddOrEdit f = new InstallmentsAddOrEdit(); //f.IdInstalment = id; //f.Type = 0; //f.ShowDialog(); } else if (e.ColumnIndex == 1) // Delete mode { if (MessageBox.Show("آیا از حذف این قسط اطمینان دارید؟", "خطا", MessageBoxButtons.YesNo) == DialogResult.Yes) { InstallementsService.InstallementsServiceClient b = new InstallementsService.InstallementsServiceClient(); b.DeleteInstallements(id); MessageBox.Show("با موفقیت حذف شد"); a = new InstallementsService.InstallementsServiceClient(); dataGridView1.DataSource = a.GetLoanInstallements(Id1).Select(x => new { x.Id, x.Amount, x.PaymentDate, x.IsPayed }).ToList(); MyFormLoad(); } } else if (e.ColumnIndex == 2) // Done mode { PayedInstallment f = new PayedInstallment(); f.InsId = id; f.ShowDialog(); MyFormLoad(); } }