C2019-033 added a method to get the entire list of usages for a library document.

C2019-033 made the messaging clearer when saving a word attachment that is a library document
This commit is contained in:
John Jenko 2019-09-17 19:34:14 +00:00
parent 955c35bab1
commit 24015e387f
2 changed files with 34 additions and 3 deletions

View File

@ -221,6 +221,30 @@ namespace VEPROMS.CSLA.Library
return sb.ToString(); return sb.ToString();
} }
} }
// C2019-033 - Used when saving a Word Attachment that is a Library Document (will get all usages)
public string LibraryDocumentUsageAll
{
get
{
StringBuilder sb = new StringBuilder();
string sep = "\r\nUsed In:\r\n ";
if (DocumentEntries == null)
sb.Append("None");
else
{
foreach (EntryInfo myEntry in DocumentEntries)
{
foreach (ItemInfo myItem in myEntry.MyContent.ContentItems)
{
ItemInfo proc = myItem.MyProcedure;
sb.Append(sep + proc.DisplayNumber + " - " + proc.DisplayText);
sep = "\r\n ";
}
}
}
return sb.ToString();
}
}
public ItemInfoList LibraryDocumentUsageList public ItemInfoList LibraryDocumentUsageList
{ {
get get

View File

@ -9,6 +9,7 @@ using VEPROMS.CSLA.Library;
using Volian.Controls.Library; using Volian.Controls.Library;
using System.Reflection; using System.Reflection;
using LBWordLibrary; using LBWordLibrary;
using JR.Utils.GUI.Forms;
namespace Volian.Controls.Library namespace Volian.Controls.Library
{ {
@ -478,7 +479,12 @@ namespace Volian.Controls.Library
EntryInfo myei = MyDisplayTabItem.MyItemInfo.MyContent.MyEntry; EntryInfo myei = MyDisplayTabItem.MyItemInfo.MyContent.MyEntry;
if (myei != null && myei.MyDocument != null && myei.MyDocument.LibTitle != null && myei.MyDocument.LibTitle != "") if (myei != null && myei.MyDocument != null && myei.MyDocument.LibTitle != null && myei.MyDocument.LibTitle != "")
{ {
DialogResult ans = MessageBox.Show("Save as Library Document for all usages?", "Document Save", MessageBoxButtons.YesNo); // C2019-033 - make save options more clear with respect to library documents
string msgstr = "Save to Library Document?" +
"\n\n YES - Save for all usages of this Library Document." +
"\n\n NO - Unlink this Section from the Library Document and Save in this Word Section.\n\n" +
_MyDocumentInfo.LibraryDocumentUsageAll;
DialogResult ans = FlexibleMessageBox.Show(msgstr, "Document Save", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (ans == DialogResult.No) cvtLibDoc = true; if (ans == DialogResult.No) cvtLibDoc = true;
} }
} }
@ -571,8 +577,9 @@ namespace Volian.Controls.Library
} }
//if (MessageBox.Show("Save changes to " + _MyDisplayTabItem.MyItemInfo.TabTitle + "\r\n" + _MyDisplayTabItem.MyItemInfo.TabToolTip, "Document has Changed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) //if (MessageBox.Show("Save changes to " + _MyDisplayTabItem.MyItemInfo.TabTitle + "\r\n" + _MyDisplayTabItem.MyItemInfo.TabToolTip, "Document has Changed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
// B2017-249 Recover Temporary File And AutoSave support for MSWord // B2017-249 Recover Temporary File And AutoSave support for MSWord
if (MessageBox.Show("Save changes to " + (MyDSOFile.MyDocument.ContentIsDirty ? "Recovered Version of " : "") + _MyDisplayTabItem.Text + "\r\n" + _MyDisplayTabItem.Tooltip, // C2019-033 - make save options more clear with respect to library documents second dialog will appear if Yes is selected and it's a library document
(IsDirty ? "Document has Changed" : "Previous Changes were not saved."), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) string msgstr = "Save changes to " + (MyDSOFile.MyDocument.ContentIsDirty ? "Recovered Version of " : "") + _MyDisplayTabItem.Text;
if (FlexibleMessageBox.Show(msgstr, (IsDirty ? "Document has Changed" : "Previous Changes were not Saved"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
return SaveDSO(); return SaveDSO();
//Console.WriteLine("Delete {0}", MyDSOFile.MyFile.Name); //Console.WriteLine("Delete {0}", MyDSOFile.MyFile.Name);
DeleteOnClose = true; DeleteOnClose = true;