private void llCreateFootonoteForSelectedTimePeriod_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            PxTime pxTime = (PxTime)lbTimePeriods.SelectedItem;

            if (pxTime != null)
            {
                var timeFootnoteArray = (from tf in pxTime.TimeFootnotes
                                         select tf).ToArray();
                FootnoteDialog frmFootnote = new FootnoteDialog();

                frmFootnote.Context         = pxTime;
                pxTime.Content.FootnoteTime = "B";

                if (timeFootnoteArray.Count() == 0)
                {
                    PxTimeFootnote timeFootnote = (PxTimeFootnote)CreateTimeFootnote(pxTime);
                    timeFootnoteArray = (from tf in pxTime.TimeFootnotes
                                         select tf).ToArray();
                }
                frmFootnote.SetDataSource((PxFootnote[])timeFootnoteArray);

                frmFootnote.AddFotnoteHandler     = CreateTimeFootnote;
                frmFootnote.RemoveFootnoteHandler = RemoveTimeFootnote;
                frmFootnote.ShowDialog();
            }
            else
            {
                MessageBox.Show("Select a time period first!");
            }
        }
        public PxTimeFootnote CreateTimeFootnote(PxObject context)
        {
            PxTimeFootnote tf = new PxTimeFootnote();

            tf.FootnoteNo = FootnoteNo;
            FootnoteNo++;
            tf.FootnoteText        = "Shenim i ri";
            tf.FootnoteTextEnglish = "New Footnote";
            tf.MandOption          = "O";
            tf.ShowFootnote        = "B";
            tf.IsNew = true;
            ((PxTime)lbTimePeriods.SelectedItem).TimeFootnotes.Add(tf);
            return(tf);
        }