File Date/Time changed to UTC to eliminate Daylight Savings Time Issue

This commit is contained in:
Rich 2011-12-02 16:28:53 +00:00
parent f5e8cca1f8
commit aed6c8740c
6 changed files with 21 additions and 21 deletions

View File

@ -729,12 +729,12 @@ namespace VEPROMS
break; break;
} }
FileInfo fiRofst = new FileInfo(rofstPath); FileInfo fiRofst = new FileInfo(rofstPath);
if (SelectedROFst.DTS == fiRofst.LastWriteTime) if (SelectedROFst.DTS == fiRofst.LastWriteTimeUtc)
{ {
MessageBox.Show("ro.fst files are same for path " + rdi.FolderPath + ", import of that ro.fst will not be done"); MessageBox.Show("ro.fst files are same for path " + rdi.FolderPath + ", import of that ro.fst will not be done");
break; break;
} }
if (SelectedROFst.DTS > fiRofst.LastWriteTime) if (SelectedROFst.DTS > fiRofst.LastWriteTimeUtc)
{ {
MessageBox.Show("Cannot copy older ro.fst from " + rdi.FolderPath + ", import of that ro.fst will not be done"); MessageBox.Show("Cannot copy older ro.fst from " + rdi.FolderPath + ", import of that ro.fst will not be done");
break; break;

View File

@ -339,7 +339,7 @@ namespace VEPROMS.CSLA.Library
// using (RODb rd = RODb.Get(rdi.RODbID)) // using (RODb rd = RODb.Get(rdi.RODbID))
// { // {
// ROFst rofst = ROFst.MakeROFst(rd, ab, null, di.LastWriteTime, rdi.UserID); // ROFst rofst = ROFst.MakeROFst(rd, ab, null, di.LastWriteTimeUtc, rdi.UserID);
// // Hook this into the current docversion by replacing the rofstid field in the doc version // // Hook this into the current docversion by replacing the rofstid field in the doc version
// // association object: // // association object:
// dva.MyROFst = rofst; // dva.MyROFst = rofst;
@ -428,7 +428,7 @@ namespace VEPROMS.CSLA.Library
// { // {
// FileInfo fi = new FileInfo(imgfile); // FileInfo fi = new FileInfo(imgfile);
// // if the roimage record exists, don't create a new one... // // if the roimage record exists, don't create a new one...
// using (roImg = ROImage.GetByRODbID_FileName_DTS(rdi.RODbID, imgname, fi.LastWriteTime)) // using (roImg = ROImage.GetByRODbID_FileName_DTS(rdi.RODbID, imgname, fi.LastWriteTimeUtc))
// { // {
// if (roImg == null) // if (roImg == null)
// { // {
@ -439,7 +439,7 @@ namespace VEPROMS.CSLA.Library
// fsIn.Close(); // fsIn.Close();
// using (RODb rodb = RODb.Get(rdi.RODbID)) // using (RODb rodb = RODb.Get(rdi.RODbID))
// { // {
// roImg = ROImage.MakeROImage(rodb, imgname, ab, null, fi.LastWriteTime, "Migration"); // roImg = ROImage.MakeROImage(rodb, imgname, ab, null, fi.LastWriteTimeUtc, "Migration");
// } // }
// } // }
// Figure figure = Figure.GetByROFstID_ImageID(this.ROFstID, roImg.ImageID); // Figure figure = Figure.GetByROFstID_ImageID(this.ROFstID, roImg.ImageID);

View File

@ -275,8 +275,8 @@ namespace VEPROMS.CSLA.Library
FileStream fs = _MyFile.Create(); FileStream fs = _MyFile.Create();
if (MyDocument.DocContent != null) fs.Write(MyDocument.DocContent, 0, MyDocument.DocContent.Length); if (MyDocument.DocContent != null) fs.Write(MyDocument.DocContent, 0, MyDocument.DocContent.Length);
fs.Close(); fs.Close();
_MyFile.CreationTime = _MyDocument.DTS; _MyFile.CreationTimeUtc = _MyDocument.DTS;
_MyFile.LastWriteTime = _MyDocument.DTS; _MyFile.LastWriteTimeUtc = _MyDocument.DTS;
_Created = true; _Created = true;
} }
} }
@ -333,7 +333,7 @@ namespace VEPROMS.CSLA.Library
cfg.Edit_Initialized = true; cfg.Edit_Initialized = true;
doc.Config = cfg.ToString(); doc.Config = cfg.ToString();
doc.UserID = Volian.Base.Library.VlnSettings.UserID; doc.UserID = Volian.Base.Library.VlnSettings.UserID;
doc.DTS = _MyFile.LastWriteTime; doc.DTS = _MyFile.LastWriteTimeUtc;
doc = doc.Save(); doc = doc.Save();
List<string> roids = new List<string>(); List<string> roids = new List<string>();
string pdfTmp = MSWordToPDF.ToPDFReplaceROs(_MyDocument, roids, myItemInfo); string pdfTmp = MSWordToPDF.ToPDFReplaceROs(_MyDocument, roids, myItemInfo);

View File

@ -197,7 +197,7 @@ namespace VEPROMS.CSLA.Library
// check if this rofst has been loaded, i.e. dts on file versus dts in db... // check if this rofst has been loaded, i.e. dts on file versus dts in db...
// if so, just make association with docversion. // if so, just make association with docversion.
ROFst rofst = ROFst.GetByRODbID_DTS(rdi.RODbID, di.LastWriteTime); ROFst rofst = ROFst.GetByRODbID_DTS(rdi.RODbID, di.LastWriteTimeUtc);
if (rofst != null) if (rofst != null)
{ {
docver.DocVersionAssociations.Add(rofst); docver.DocVersionAssociations.Add(rofst);
@ -218,7 +218,7 @@ namespace VEPROMS.CSLA.Library
{ {
Dictionary<string, int> myROImagesList = BuildROImagesList(myROImages); Dictionary<string, int> myROImagesList = BuildROImagesList(myROImages);
List<int> myROImageIDs = new List<int>(); List<int> myROImageIDs = new List<int>();
rofst = ROFst.MakeROFst(rodb, ab, null, di.LastWriteTime, rdi.UserID); rofst = ROFst.MakeROFst(rodb, ab, null, di.LastWriteTimeUtc, rdi.UserID);
// Hook this into the current docversion by replacing the rofstid field in the doc version // Hook this into the current docversion by replacing the rofstid field in the doc version
// association object: // association object:
docver.DocVersionAssociations.Add(rofst); docver.DocVersionAssociations.Add(rofst);
@ -258,7 +258,7 @@ namespace VEPROMS.CSLA.Library
DirectoryInfo di = new DirectoryInfo(rdi.FolderPath); DirectoryInfo di = new DirectoryInfo(rdi.FolderPath);
// check if this rofst has been loaded, i.e. dts on file versus dts in db... // check if this rofst has been loaded, i.e. dts on file versus dts in db...
// if so, just make association to existing with docversion. // if so, just make association to existing with docversion.
ROFst rofst = ROFst.GetByRODbID_DTS(rdi.RODbID, di.LastWriteTime); ROFst rofst = ROFst.GetByRODbID_DTS(rdi.RODbID, di.LastWriteTimeUtc);
if (rofst != null) if (rofst != null)
{ {
docver.DocVersionAssociations[0].MyROFst = rofst; docver.DocVersionAssociations[0].MyROFst = rofst;
@ -275,7 +275,7 @@ namespace VEPROMS.CSLA.Library
fsIn.Close(); fsIn.Close();
using (RODb rodb = RODb.GetJustRoDb(rdi.RODbID)) using (RODb rodb = RODb.GetJustRoDb(rdi.RODbID))
{ {
rofst = ROFst.MakeROFst(rodb, ab, null, di.LastWriteTime, rdi.UserID); rofst = ROFst.MakeROFst(rodb, ab, null, di.LastWriteTimeUtc, rdi.UserID);
// Hook this into the current docversion by replacing the rofstid field in the doc version // Hook this into the current docversion by replacing the rofstid field in the doc version
// association object: // association object:
dva.MyROFst = rofst; dva.MyROFst = rofst;
@ -508,7 +508,7 @@ namespace VEPROMS.CSLA.Library
{ {
FileInfo fi = new FileInfo(imgfile); FileInfo fi = new FileInfo(imgfile);
// if the roimage record exists, don't create a new one... // if the roimage record exists, don't create a new one...
string key = ROImageKey(imgname, fi.LastWriteTime); string key = ROImageKey(imgname, fi.LastWriteTimeUtc);
if (myROImagesList.ContainsKey(key)) if (myROImagesList.ContainsKey(key))
{ {
int imageID = myROImagesList[key]; int imageID = myROImagesList[key];
@ -522,7 +522,7 @@ namespace VEPROMS.CSLA.Library
byte[] ab = r.ReadBytes((int)fsIn.Length); byte[] ab = r.ReadBytes((int)fsIn.Length);
r.Close(); r.Close();
fsIn.Close(); fsIn.Close();
roImg = ROImage.MakeROImage(rodb, imgname, ab, null, fi.LastWriteTime, "Migration"); roImg = ROImage.MakeROImage(rodb, imgname, ab, null, fi.LastWriteTimeUtc, "Migration");
Figure figure = Figure.GetByROFstID_ImageID(this.ROFstID, roImg.ImageID); Figure figure = Figure.GetByROFstID_ImageID(this.ROFstID, roImg.ImageID);
if (figure != null) return; if (figure != null) return;
figure = Figure.MakeFigure(rofst, roImg, null); figure = Figure.MakeFigure(rofst, roImg, null);

View File

@ -165,8 +165,8 @@ namespace VEPROMS.CSLA.Library
FileStream fs = _MyFile.Create(); FileStream fs = _MyFile.Create();
fs.Write(MyROImage.Content, 0, MyROImage.Content.Length); fs.Write(MyROImage.Content, 0, MyROImage.Content.Length);
fs.Close(); fs.Close();
_MyFile.CreationTime = MyROImage.DTS; _MyFile.CreationTimeUtc = MyROImage.DTS;
_MyFile.LastWriteTime = MyROImage.DTS; _MyFile.LastWriteTimeUtc = MyROImage.DTS;
_Created = true; _Created = true;
} }
} }
@ -196,7 +196,7 @@ namespace VEPROMS.CSLA.Library
//roImage.FileName; //roImage.FileName;
roImage.Content = buf; roImage.Content = buf;
roImage.UserID = Volian.Base.Library.VlnSettings.UserID; roImage.UserID = Volian.Base.Library.VlnSettings.UserID;
roImage.DTS = _MyFile.LastWriteTime; roImage.DTS = _MyFile.LastWriteTimeUtc;
roImage.Save(); roImage.Save();
} }
#endregion #endregion

View File

@ -1282,12 +1282,12 @@ namespace Volian.Controls.Library
return; return;
} }
FileInfo fiRofst = new FileInfo(rofstPath); FileInfo fiRofst = new FileInfo(rofstPath);
if (roFstInfo.DTS == fiRofst.LastWriteTime) if (roFstInfo.DTS == fiRofst.LastWriteTimeUtc)
{ {
MessageBox.Show("ro.fst files are same for path " + roFstInfo.MyRODb.FolderPath + ", import of that ro.fst will not be done"); MessageBox.Show("ro.fst files are same for path " + roFstInfo.MyRODb.FolderPath + ", import of that ro.fst will not be done");
return; return;
} }
if (roFstInfo.DTS > fiRofst.LastWriteTime) if (roFstInfo.DTS > fiRofst.LastWriteTimeUtc)
{ {
MessageBox.Show("Cannot copy older ro.fst from " + roFstInfo.MyRODb.FolderPath + ", import of that ro.fst will not be done"); MessageBox.Show("Cannot copy older ro.fst from " + roFstInfo.MyRODb.FolderPath + ", import of that ro.fst will not be done");
return; return;
@ -1368,11 +1368,11 @@ namespace Volian.Controls.Library
// if the database Ro.Fst is newer or if the files have identical DTS, // if the database Ro.Fst is newer or if the files have identical DTS,
// assume that they are the same file. // assume that they are the same file.
if (roFstInfo.DTS >= fiRofst.LastWriteTime) return false; if (roFstInfo.DTS >= fiRofst.LastWriteTimeUtc) return false;
// next see if the data is the same size, i.e. byte count of record and byte count // next see if the data is the same size, i.e. byte count of record and byte count
// of file. If different sizes, the date/time stamp check will hold. // of file. If different sizes, the date/time stamp check will hold.
if (fiRofst.Length != roFstInfo.ROLookup.Length) return fiRofst.LastWriteTime > roFstInfo.DTS; if (fiRofst.Length != roFstInfo.ROLookup.Length) return fiRofst.LastWriteTimeUtc > roFstInfo.DTS;
// if we can't tell by the DTS or size, compare the contents. Get all of the rodb's // if we can't tell by the DTS or size, compare the contents. Get all of the rodb's
// rofsts of the size of the file & compare bytes. If // rofsts of the size of the file & compare bytes. If