Added new property NewerRoFst that checks to see if a Newer ROFst is available to DocVersion and DocVersionInfo
Corrected the logic to use the datetime of the ROFST rather than the datetime of it's folder. Use DocVersionInfo.NewerROFst to determine if the update button is enabled.
This commit is contained in:
@@ -274,9 +274,12 @@ namespace VEPROMS.CSLA.Library
|
||||
public static ROFst UpdateRoFst(RODbInfo rdi, DocVersionAssociation dva, DocVersion docver, ROFstInfo origROFst)
|
||||
{
|
||||
DirectoryInfo di = new DirectoryInfo(rdi.FolderPath);
|
||||
string rofstfilepath = rdi.FolderPath + @"\ro.fst";
|
||||
FileStream fsIn = new FileStream(rofstfilepath, FileMode.Open, FileAccess.Read, FileShare.Read);
|
||||
FileInfo rofstFI = new FileInfo(rofstfilepath);
|
||||
// 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.
|
||||
ROFst rofst = ROFst.GetByRODbID_DTS(rdi.RODbID, di.LastWriteTimeUtc);
|
||||
ROFst rofst = ROFst.GetByRODbID_DTS(rdi.RODbID, rofstFI.LastWriteTimeUtc);
|
||||
if (rofst != null)
|
||||
{
|
||||
docver.DocVersionAssociations[0].MyROFst = rofst;
|
||||
@@ -285,15 +288,13 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
|
||||
// Read in the rofst & make the rofst record.
|
||||
string rofstfilepath = rdi.FolderPath + @"\ro.fst";
|
||||
FileStream fsIn = new FileStream(rofstfilepath, FileMode.Open, FileAccess.Read, FileShare.Read);
|
||||
// Create an instance of StreamReader that can read characters from the FileStream.
|
||||
BinaryReader r = new BinaryReader(fsIn);
|
||||
byte[] ab = r.ReadBytes((int)fsIn.Length);
|
||||
fsIn.Close();
|
||||
using (RODb rodb = RODb.GetJustRoDb(rdi.RODbID))
|
||||
{
|
||||
rofst = ROFst.MakeROFst(rodb, ab, null, di.LastWriteTimeUtc, rdi.UserID);
|
||||
rofst = ROFst.MakeROFst(rodb, ab, null, rofstFI.LastWriteTimeUtc, rdi.UserID);
|
||||
// Hook this into the current docversion by replacing the rofstid field in the doc version
|
||||
// association object:
|
||||
dva.MyROFst = rofst;
|
||||
|
Reference in New Issue
Block a user