private void llAddFootnoteContentValue_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { PxContent pxContent = SelectedContent; PxVariable variable = SelectedVariable; PxValue value = SelectedValue; if (pxContent != null && variable != null && value != null) { var contentValueFootnoteArray = (from vf in pxContent.ContentValueFootnotes where vf.Variable.Variable == variable.Variable && vf.Value.ValuePool == value.ValuePool && vf.Value.ValueCode == value.ValueCode select vf).ToArray(); FootnoteDialog frmFootnote = new FootnoteDialog(); frmFootnote.Context = pxContent; pxContent.FootnoteValue = "B"; if (contentValueFootnoteArray.Count() == 0) { PxContentValueFootnote contentValueFootnote = (PxContentValueFootnote)CreateContentValueFootnote(pxContent); contentValueFootnoteArray = (from vf in pxContent.ContentValueFootnotes where vf.Variable == variable && vf.Value == value select vf).ToArray(); } frmFootnote.SetDataSource((PxFootnote[])contentValueFootnoteArray); frmFootnote.AddFotnoteHandler = CreateContentValueFootnote; frmFootnote.RemoveFootnoteHandler = RemoveContentValueFootnote; frmFootnote.ShowDialog(); } else { MessageBox.Show("Select a content, a variable and a value first!"); } }
public PxContentValueFootnote CreateContentValueFootnote(PxObject context) { PxContentValueFootnote cvf = new PxContentValueFootnote(); cvf.FootnoteNo = FootnoteNo; FootnoteNo++; cvf.FootnoteText = "Shenim i ri"; cvf.FootnoteTextEnglish = "New Footnote"; cvf.MandOption = "M"; cvf.ShowFootnote = "B"; cvf.IsNew = true; cvf.Variable = SelectedVariable; cvf.Value = SelectedValue; SelectedContent.ContentValueFootnotes.Add(cvf); SelectedContent.MarkAsDirty(); SelectedMainTable.MarkAsDirty(); return(cvf); }