public void RemoveTimeFootnote(PxObject context, PxFootnote footnote)
 {
     ((PxTime)lbTimePeriods.SelectedItem).TimeFootnotes.Remove((PxTimeFootnote)footnote);
     if (!footnote.IsNew)
     {
         ((PxTime)lbTimePeriods.SelectedItem).RemovedTimeFootnotes.Add((PxTimeFootnote)footnote);
     }
 }
 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;
 }
 public PxFootnote CreateContentFootnote(PxObject context)
 {
     PxContentFootnote f = new PxContentFootnote();
     f.FootnoteNo = FootnoteNo;
     FootnoteNo++;
     f.FootnoteText = "Shenim i ri";
     f.FootnoteTextEnglish = "New Footnote";
     f.MandOption = "O";
     f.ShowFootnote = "B";
     f.IsNew = true;
     ((PxContent)lbContents.SelectedItem).Footnotes.Add(f);
     ((PxContent)lbContents.SelectedItem).MarkAsDirty();
     _table.MarkAsDirty();
     return f;
 }
 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;
 }
 public static bool Save(PxObject obj, ref string message)
 {
     try
     {
         PxMetaModel.PcAxisMetabaseEntities context = new PxMetaModel.PcAxisMetabaseEntities();
         obj.Save(context);
         context.SaveChanges();
         obj.MarkAsOld();
     }
     catch (Exception ex)
     {
         //TODO chage the exception type to EF Exception and look for an inner exception.
         if (string.IsNullOrEmpty(ex.InnerException.Message))
         {
             message = ex.Message;
         }
         else
         {
             message = ex.InnerException.Message;
         }
         return false;
     }
     return true;
 }
        public static bool Delete(PxObject obj, ref string message)
        {
            try
            {
                if (obj == null) return true;
                PxMetaModel.PcAxisMetabaseEntities context = new PxMetaModel.PcAxisMetabaseEntities();

                obj.DeleteEntities(context);
                context.SaveChanges();
            }
            catch (Exception ex)
            {
                //TODO chage the exception type to EF Exception and look for an inner exception.
                if (ex.InnerException == null)
                {
                    message = ex.Message;
                }
                else
                {
                    message = ex.InnerException.Message;
                }
                return false;
            }
            return true;
        }
 public PxMainTableValueFootnote CreateMainTableValueFootnote(PxObject context)
 {
     PxMainTableValueFootnote mtvf = new PxMainTableValueFootnote();
     mtvf.FootnoteNo = FootnoteNo;
     FootnoteNo++;
     mtvf.FootnoteText = "Shenim i ri";
     mtvf.FootnoteTextEnglish = "New Footnote";
     mtvf.MandOption = "O";
     mtvf.ShowFootnote = "B";
     mtvf.IsNew = true;
     mtvf.Variable = SelectedVariable;
     mtvf.Value = SelectedValue;
     SelectedMainTable.MainTableValueFootnotes.Add(mtvf);
     SelectedMainTable.MarkAsDirty();
     SelectedValue.MarkAsDirty();
     return mtvf;
 }
 public void RemoveValueFootnote(PxObject context, PxFootnote footnote)
 {
     SelectedValue.ValueFootnotes.Remove((PxValueFootnote)footnote);
     if (!footnote.IsNew)
     {
         SelectedValue.RemovedValueFootnotes.Add((PxValueFootnote)footnote);
         SelectedValue.MarkAsDirty();
         SelectedMainTable.MarkAsDirty();
     }
 }
 public void RemoveMainTableValueFootnote(PxObject context, PxFootnote footnote)
 {
     SelectedMainTable.MainTableValueFootnotes.Remove((PxMainTableValueFootnote)footnote);
     if (!footnote.IsNew)
     {
         SelectedMainTable.RemovedMainTableValueFootnotes.Add((PxMainTableValueFootnote)footnote);
         ((PxValueSet)lbValuesets.SelectedItem).MarkAsDirty();
     }
 }
 public void RemoveContentValueFootnote(PxObject context, PxFootnote footnote)
 {
     SelectedContent.ContentValueFootnotes.Remove((PxContentValueFootnote)footnote);
     if (!footnote.IsNew)
     {
         SelectedContent.RemovedContentValueFootnotes.Add((PxContentValueFootnote)footnote);
     }
 }
 public PxValueFootnote CreateValueFootnote(PxObject context)
 {
     PxValueFootnote vf = new PxValueFootnote();
     vf.FootnoteNo = FootnoteNo;
     FootnoteNo++;
     vf.FootnoteText = "Shenim i ri";
     vf.FootnoteTextEnglish = "New Footnote";
     vf.MandOption = "O";
     vf.ShowFootnote = "B";
     vf.IsNew = true;
     vf.Value = SelectedValue;
     SelectedValue.ValueFootnotes.Add(vf);
     SelectedValue.MarkAsDirty();
     ((PxValueSet)lbValuesets.SelectedItem).MarkAsDirty();
     return vf;
 }
 public void RemoveVariableFootnote(PxObject context, PxFootnote footnote)
 {
     ((PxVariable)lbVariables.SelectedItem).VariableFootnotes.Remove((PxVariableFootnote)footnote);
     if (!footnote.IsNew)
     {
         ((PxVariable)lbVariables.SelectedItem).RemovedVariableFootnotes.Add((PxVariableFootnote)footnote);
         ((PxVariable)lbVariables.SelectedItem).MarkAsDirty();
         _table.MarkAsDirty();
     }
 }
 public void RemoveMainTableFootnote(PxObject context, PxFootnote footnote)
 {
     _table.Footnotes.Remove((PxMainTableFootnote)footnote);
     if (!footnote.IsNew)
     {
         _table.RemovedFootnotes.Add((PxMainTableFootnote)footnote);
         _table.MarkAsDirty();
     }
 }
 public void RemoveContentFootnote(PxObject context, PxFootnote footnote)
 {
     ((PxContent)lbContents.SelectedItem).Footnotes.Remove((PxContentFootnote)footnote);
     if (!footnote.IsNew)
     {
         ((PxContent)lbContents.SelectedItem).RemovedFootnotes.Add((PxContentFootnote)footnote);
         ((PxContent)lbContents.SelectedItem).MarkAsDirty();
         _table.MarkAsDirty();
     }
 }
        public PxFootnote CreateMainTableFootnote(PxObject context)
        {
            PxMainTableFootnote f = new PxMainTableFootnote();
            f.FootnoteNo = FootnoteNo;
            FootnoteNo++;
            f.FootnoteText = "Shenim i ri";
            f.FootnoteTextEnglish = "New Footnote";
            f.MandOption = "O";
            f.ShowFootnote = "B";
            f.IsNew = true;

            _table.Footnotes.Add(f);
            _table.MarkAsDirty();
            return f;
        }
 public PxContentVariableFootnote CreateContentVariableFootnote(PxObject context)
 {
     PxContentVariableFootnote cvf = new PxContentVariableFootnote();
     cvf.FootnoteNo = FootnoteNo;
     FootnoteNo++;
     cvf.FootnoteText = "Shenim i ri";
     cvf.FootnoteTextEnglish = "New Footnote";
     cvf.MandOption = "O";
     cvf.ShowFootnote = "B";
     cvf.IsNew = true;
     cvf.Variable = (PxVariable)lbVariables.SelectedItem;
     ((PxContent)lbContents.SelectedItem).ContentVariableFootnotes.Add(cvf);
     ((PxVariable)lbVariables.SelectedItem).MarkAsDirty();
     ((PxContent)lbContents.SelectedItem).MarkAsDirty();
     _table.MarkAsDirty();
     return cvf;
 }