private void ShowAgreementForm(int agreementId, int positionId = -1) { FrmAgreement frmAgreement = new FrmAgreement(agreementId, positionId); frmAgreement.MdiParent = this.MdiParent; frmAgreement.Show(); }
private void BindNewPosition() { string ktm = gridExProductsAndArticles.CurrentRow.Cells["KTM"].Value.ToString(); string descriptor = gridExProductsAndArticles.CurrentRow.Cells["Deskryptor"].Value.ToString(); int agreementId = gridExAgreementsListGrouped.CurrentRow.GroupCaption == null ? (int)gridExAgreementsListGrouped.CurrentRow.Cells["IdUmowy"].Value : Convert.ToInt16(gridExAgreementsListGrouped.CurrentRow.GroupCaption); int selectedAgreementRowId = gridExAgreementsListGrouped.CurrentRow.Position; if (MessageBox.Show(string.Format("Do umowy {0} zostanie dopisana nowa pozycja:\r\n\r\nKTM:\t\t{1}\r\nDeskryptor:\t{2}", agreementId.ToString(), ktm, descriptor), "Przypisanie", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK) { try { FrmAgreement frmAgreement = new FrmAgreement(agreementId, -1); frmAgreement.AddPosition(null, ktm, descriptor); frmAgreement.ShowDialog(); } catch { MessageBox.Show("Nie udało się wykonać powiązania.\r\nOdśwież listę i spróbuj ponownie.", "Przypisanie", MessageBoxButtons.OK, MessageBoxIcon.Error); } this.LoadData(); } }