B2017-219 if a word section cannot be opened because it is gotten from a bad database record, then create a blank word document and open it
This commit is contained in:
parent
61a31cec22
commit
73593b8546
@ -18,6 +18,11 @@ namespace Volian.Controls.Library
|
|||||||
private DisplayTabControl _MyDisplayTabControl;
|
private DisplayTabControl _MyDisplayTabControl;
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
private AxEDWordLib.AxEDWord _MyEdWord; // B2017-133 Edraw DSO Framer Replacement
|
private AxEDWordLib.AxEDWord _MyEdWord; // B2017-133 Edraw DSO Framer Replacement
|
||||||
|
public AxEDWordLib.AxEDWord MyEdWord
|
||||||
|
{
|
||||||
|
get { return _MyEdWord; }
|
||||||
|
set { _MyEdWord = value; }
|
||||||
|
}
|
||||||
private TransparentPanel _MyTransparentPanel;
|
private TransparentPanel _MyTransparentPanel;
|
||||||
private static int _Count = 0;
|
private static int _Count = 0;
|
||||||
private DocumentInfo _MyDocumentInfo;
|
private DocumentInfo _MyDocumentInfo;
|
||||||
@ -108,6 +113,7 @@ namespace Volian.Controls.Library
|
|||||||
SetupDSOTabPanel();
|
SetupDSOTabPanel();
|
||||||
_MyDocumentInfo = documentInfo;
|
_MyDocumentInfo = documentInfo;
|
||||||
SetupDSO();
|
SetupDSO();
|
||||||
|
if (_MyEdWord == null) return; //B2017-219 could not open the word attachment so just return
|
||||||
_RefreshTimer = new Timer(); // Enabled is false and interval is 1/10th of second.
|
_RefreshTimer = new Timer(); // Enabled is false and interval is 1/10th of second.
|
||||||
_RefreshTimer.Interval = 500;// B2017-133 Edraw
|
_RefreshTimer.Interval = 500;// B2017-133 Edraw
|
||||||
ClientSizeChanged += new EventHandler(DSOTabPanel_ClientSizeChanged);
|
ClientSizeChanged += new EventHandler(DSOTabPanel_ClientSizeChanged);
|
||||||
@ -220,12 +226,15 @@ namespace Volian.Controls.Library
|
|||||||
System.IO.FileStream fs = MyDSOFile.MyFile.Create();
|
System.IO.FileStream fs = MyDSOFile.MyFile.Create();
|
||||||
fs.Write(myDoc.DocContent, 0, myDoc.DocContent.Length);
|
fs.Write(myDoc.DocContent, 0, myDoc.DocContent.Length);
|
||||||
fs.Close();
|
fs.Close();
|
||||||
_MyDocumentInfo = DocumentInfo.Get(MyDocumentInfo.DocID);
|
MyDSOFile.SaveFile(0, "", _ItemInfo, false, StatusChanged); // B2017-219 save the restored document to database
|
||||||
DocumentInfo.Refresh(myDoc);
|
this._MyEdWord = null; // B2017-219 Set MyEdWord to null - we will check for this in the calling functions
|
||||||
//_DSOFile = null;
|
return;
|
||||||
this._MyEdWord.Open(MyDSOFile.MyFile.FullName);
|
//_MyDocumentInfo = DocumentInfo.Get(MyDocumentInfo.DocID);
|
||||||
doc = new LBDocumentClass(_MyEdWord.ActiveDocument());
|
//DocumentInfo.Refresh(myDoc);
|
||||||
doc.Range(1, 1);
|
////_DSOFile = null;
|
||||||
|
//this._MyEdWord.Open(MyDSOFile.MyFile.FullName);
|
||||||
|
//doc = new LBDocumentClass(_MyEdWord.ActiveDocument());
|
||||||
|
//doc.Range(1, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,8 +243,11 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
System.IO.FileStream fs = MyDSOFile.MyFile.Create();
|
System.IO.FileStream fs = MyDSOFile.MyFile.Create();
|
||||||
fs.Close();
|
fs.Close();
|
||||||
|
MyDSOFile.SaveFile(0, "", _ItemInfo, false, StatusChanged); // B2017-219 save the blank document to database
|
||||||
MessageBox.Show("Reverting to Blank Document", "Error in MS Word section",
|
MessageBox.Show("Reverting to Blank Document", "Error in MS Word section",
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||||
|
this._MyEdWord = null; // B2017-219 Set MyEdWord to null - we will check for this in the calling functions
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this._MyEdWord.Open(MyDSOFile.MyFile.FullName);// B2017-133 Edraw
|
this._MyEdWord.Open(MyDSOFile.MyFile.FullName);// B2017-133 Edraw
|
||||||
|
@ -1044,6 +1044,16 @@ namespace Volian.Controls.Library
|
|||||||
//if ((myItemInfo.MyContent.MyEntry.MyDocument.LibTitle ?? "") != "")
|
//if ((myItemInfo.MyContent.MyEntry.MyDocument.LibTitle ?? "") != "")
|
||||||
// MessageBox.Show("WARNING: All edits made to this Library Document will be applied to all uses of the Document");
|
// MessageBox.Show("WARNING: All edits made to this Library Document will be applied to all uses of the Document");
|
||||||
pg = new DisplayTabItem(this.components, this, myItemInfo, key); // Open a new document page
|
pg = new DisplayTabItem(this.components, this, myItemInfo, key); // Open a new document page
|
||||||
|
// B2917-219 if MyEdWord is null that means we had trouble opening the word attachment and either a blank document was created or a previous version was recovered
|
||||||
|
// so we now we want to open the now blank or recovered attachment
|
||||||
|
if (pg.MyDSOTabPanel.MyEdWord == null)
|
||||||
|
{
|
||||||
|
pg = OpenDSOTabPage(myItemInfo);
|
||||||
|
if (pg.MyDSOTabPanel.MyEdWord == null)
|
||||||
|
return null; // even the blank or recovered attachment cannot be opened
|
||||||
|
else
|
||||||
|
return pg;
|
||||||
|
}
|
||||||
_MyDisplayTabItems.Add(key, pg);
|
_MyDisplayTabItems.Add(key, pg);
|
||||||
}
|
}
|
||||||
SelectDisplayTabItem(pg);
|
SelectDisplayTabItem(pg);
|
||||||
|
@ -93,26 +93,27 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Constructors
|
#region Constructors
|
||||||
public DisplayTabItem(IContainer container, DisplayTabControl myDisplayTabControl, ItemInfo myItemInfo, string myKey)
|
public DisplayTabItem(IContainer container, DisplayTabControl myDisplayTabControl, ItemInfo myItemInfo, string myKey)
|
||||||
{
|
{
|
||||||
_MyItemInfo = myItemInfo;
|
_MyItemInfo = myItemInfo;
|
||||||
if(MyItemInfo.MyContent.MyEntry == null)
|
if (MyItemInfo.MyContent.MyEntry == null)
|
||||||
OwnerID = myDisplayTabControl.MySessionInfo.CheckOutItem(myItemInfo.MyProcedure.ItemID, CheckOutType.Procedure);
|
OwnerID = myDisplayTabControl.MySessionInfo.CheckOutItem(myItemInfo.MyProcedure.ItemID, CheckOutType.Procedure);
|
||||||
else
|
else
|
||||||
OwnerID = myDisplayTabControl.MySessionInfo.CheckOutItem(myItemInfo.MyContent.MyEntry.DocID, CheckOutType.Document);
|
OwnerID = myDisplayTabControl.MySessionInfo.CheckOutItem(myItemInfo.MyContent.MyEntry.DocID, CheckOutType.Document);
|
||||||
//Console.WriteLine("DisplayTabItem");
|
//Console.WriteLine("DisplayTabItem");
|
||||||
_MyKey = myKey;
|
_MyKey = myKey;
|
||||||
_MyDisplayTabControl = myDisplayTabControl;
|
_MyDisplayTabControl = myDisplayTabControl;
|
||||||
container.Add(this);
|
container.Add(this);
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.Click += new EventHandler(DisplayTabItem_Click);
|
this.Click += new EventHandler(DisplayTabItem_Click);
|
||||||
if (myItemInfo.MyContent.MyEntry == null)
|
if (myItemInfo.MyContent.MyEntry == null)
|
||||||
SetupStepTabPanel();
|
SetupStepTabPanel();
|
||||||
else
|
else
|
||||||
SetupDSOTabPanel();
|
SetupDSOTabPanel();
|
||||||
SetupSecurity(myItemInfo);
|
SetupSecurity(myItemInfo);
|
||||||
Name = string.Format("DisplayTabItem {0}", myItemInfo.ItemID);
|
if (MyDSOTabPanel == null || MyDSOTabPanel.MyEdWord != null) // B2017-219 check needed if we could not open a word attachment
|
||||||
}
|
Name = string.Format("DisplayTabItem {0}", myItemInfo.ItemID);
|
||||||
|
}
|
||||||
private bool MesssageShown = false;
|
private bool MesssageShown = false;
|
||||||
public void SetupSecurity(ItemInfo myItem)
|
public void SetupSecurity(ItemInfo myItem)
|
||||||
{
|
{
|
||||||
@ -302,6 +303,7 @@ namespace Volian.Controls.Library
|
|||||||
EntryInfo myEntry = _MyItemInfo.MyContent.MyEntry;
|
EntryInfo myEntry = _MyItemInfo.MyContent.MyEntry;
|
||||||
UserInfo ui = UserInfo.GetByUserID(OwnerInfo.Get(OwnerID).SessionUserID);
|
UserInfo ui = UserInfo.GetByUserID(OwnerInfo.Get(OwnerID).SessionUserID);
|
||||||
_MyDSOTabPanel = new DSOTabPanel(myEntry.MyDocument, _MyDisplayTabControl, _MyItemInfo, UserInfo.CanEdit(ui,MyItemInfo.MyDocVersion));
|
_MyDSOTabPanel = new DSOTabPanel(myEntry.MyDocument, _MyDisplayTabControl, _MyItemInfo, UserInfo.CanEdit(ui,MyItemInfo.MyDocVersion));
|
||||||
|
if (_MyDSOTabPanel.MyEdWord == null) return; // B2017-219 if we could not open the word attachment just return
|
||||||
//
|
//
|
||||||
// tabItem
|
// tabItem
|
||||||
//
|
//
|
||||||
|
Loading…
x
Reference in New Issue
Block a user