private void llAddFootnoteInSelectedVariable_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { PxVariable pxVariable = (PxVariable)lbVariables.SelectedItem; if (pxVariable != null) { var variableFootnoteArray = (from vf in pxVariable.VariableFootnotes select vf).ToArray(); FootnoteDialog frmFootnote = new FootnoteDialog(); frmFootnote.Context = pxVariable; //TODO a better solution for Footnote pxVariable.Footnote = "B"; if (variableFootnoteArray.Count() == 0) { PxVariableFootnote variableFootnote = (PxVariableFootnote)CreateVariableFootnote(pxVariable); variableFootnoteArray = (from vf in pxVariable.VariableFootnotes select vf).ToArray(); } frmFootnote.SetDataSource((PxFootnote[])variableFootnoteArray); frmFootnote.AddFotnoteHandler = CreateVariableFootnote; frmFootnote.RemoveFootnoteHandler = RemoveVariableFootnote; frmFootnote.ShowDialog(); } else { MessageBox.Show("Select a content and a variable first!"); } }
private void llAddFootnoteInSelectedVariableForSelectedContent_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { PxContent pxContent = (PxContent)lbContents.SelectedItem; PxVariable variable = (PxVariable)lbVariables.SelectedItem; if (pxContent != null && variable != null) { var contentVariableFootnoteArray = (from vf in pxContent.ContentVariableFootnotes where vf.Variable == variable select vf).ToArray(); FootnoteDialog frmFootnote = new FootnoteDialog(); frmFootnote.Context = pxContent; pxContent.FootnoteVariable = "B"; if (contentVariableFootnoteArray.Count() == 0) { PxContentVariableFootnote contentVariableFootnote = (PxContentVariableFootnote)CreateContentVariableFootnote(pxContent); contentVariableFootnoteArray = (from vf in pxContent.ContentVariableFootnotes where vf.Variable == variable select vf).ToArray(); } frmFootnote.SetDataSource((PxFootnote[])contentVariableFootnoteArray); frmFootnote.AddFotnoteHandler = CreateContentVariableFootnote; frmFootnote.RemoveFootnoteHandler = RemoveContentVariableFootnote; frmFootnote.ShowDialog(); } else { MessageBox.Show("Select a content and a variable first!"); } }
private void llAddFootnoteMainTValue_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { PxMainTable pxMainTable = SelectedMainTable; PxVariable variable = SelectedVariable; PxValue value = SelectedValue; if (variable != null && value != null) { var contentMainTableValueFootnoteArray = (from mtvf in pxMainTable.MainTableValueFootnotes where mtvf.Variable.Variable == variable.Variable && mtvf.Value.ValuePool == value.ValuePool && mtvf.Value.ValueCode == value.ValueCode select mtvf).ToArray(); FootnoteDialog frmFootnote = new FootnoteDialog(); frmFootnote.Context = pxMainTable; pxMainTable.MarkAsDirty(); if (contentMainTableValueFootnoteArray.Count() == 0) { PxMainTableValueFootnote mainTableValueFootnote = (PxMainTableValueFootnote)CreateMainTableValueFootnote(pxMainTable); contentMainTableValueFootnoteArray = (from vf in pxMainTable.MainTableValueFootnotes where vf.Variable == variable && vf.Value == value select vf).ToArray(); } frmFootnote.SetDataSource((PxFootnote[])contentMainTableValueFootnoteArray); frmFootnote.AddFotnoteHandler = CreateMainTableValueFootnote; frmFootnote.RemoveFootnoteHandler = RemoveMainTableValueFootnote; frmFootnote.ShowDialog(); } else { MessageBox.Show("Select a content, a variable and a value first!"); } }
private void btnRemoveVariable_Click(object sender, EventArgs e) { if (lbVariables.SelectedItem != null) { PxVariable v = (PxVariable)lbVariables.SelectedItem; _table.Variables.Remove(v); if (!v.IsNew) { _table.RemovedVariables.Add(v); } } }
private void variableTextBox_Validating(object sender, CancelEventArgs e) { if (pxVariableBindingSource.DataSource == null) { return; } PxVariable var = ((PxVariable)pxVariableBindingSource.DataSource); if (var.IsNew) { if (VariableFacade.VariableExisit(var.Variable)) { MessageBox.Show("Variable already exists!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); e.Cancel = true; } } }