B2017-262 - Use the Word document date-time-stamp for the Document SQL record

This commit is contained in:
Rich 2017-11-21 18:17:27 +00:00
parent 7469b70b06
commit c02b088509

View File

@ -554,8 +554,11 @@ namespace VEPROMS.CSLA.Library
Document doc = _MyDocument.Get();
MyFile.Refresh(); // B2017-255 Get the latest file length before reading and saving
FileStream fs = _MyFile.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
// B2017-262 Verify that the file length is correct.
long savLen2 = fs.Length;
long savLen = _MyFile.Length;
Byte[] buf = new byte[_MyFile.Length];
if(savLen2!=savLen)_MyLog.WarnFormat("FileInfoLength = {0}, FileStreamLength= {1}", savLen, savLen2);
Byte[] buf = new byte[Math.Max(savLen,savLen2)];
fs.Read(buf, 0, buf.Length);
fs.Close();
@ -588,8 +591,9 @@ namespace VEPROMS.CSLA.Library
cfg.Edit_Initialized = true;
doc.Config = cfg.ToString();
doc.UserID = Volian.Base.Library.VlnSettings.UserID;
//doc.DTS = _MyFile.LastWriteTimeUtc;
doc.DTS = DateTime.Now.ToUniversalTime();
// B2017-262 use the date time stamp from the file rather than the clock
doc.DTS = _MyFile.LastWriteTimeUtc;
//doc.DTS = DateTime.Now.ToUniversalTime();
doc = doc.Save();
if (myItemInfo != null) // B2016-131 if myItemInfo is null, the lib doc is not referenced from any procedure. Just save changes, but don't generate a PDF
{