C2019-026 Compare the library document we are importing with one of same name in current database to see if we can use the exiting instead of creating a new one.
C2019-026 Move a byte array comparer function to the Volian.Base.Libary and made it static C2019-026 Took a byte array comparer function from ROFSTExt.cs and made it static
This commit is contained in:
@@ -4820,10 +4820,22 @@ namespace VEPROMS
|
||||
DateTime dts = DateTime.Parse(xn.Attributes.GetNamedItem("dts").InnerText);
|
||||
if (libtitle != "")
|
||||
{
|
||||
// B2019-035 better memory management. Prior logic would eat up memory (and not free it).
|
||||
string libkey = libtitle + "_" + dts.ToString();
|
||||
if (ExistingLibDocs.ContainsKey(libkey))
|
||||
d = Document.Get(ExistingLibDocs[libkey]); // found library document in existing database
|
||||
// C2019-026 if the lib doc title exists in the current database, compare it with the contents of what we
|
||||
// are importing. If the same, use it, else enter a new lib doc appending the date/time
|
||||
byte[] doccontent = Convert.FromBase64String(xn.Attributes.GetNamedItem("doccontent").InnerText);
|
||||
if (ExistingLibDocs.ContainsKey(libtitle))
|
||||
{
|
||||
d = Document.Get(ExistingLibDocs[libtitle]);
|
||||
if (!ByteArrayCompare.DoCompare(d.DocContent,doccontent))
|
||||
d = null;
|
||||
}
|
||||
if (d == null)
|
||||
{
|
||||
// B2019-035 better memory management. Prior logic would eat up memory (and not free it).
|
||||
string libkey = libtitle + "_" + dts.ToString();
|
||||
if (ExistingLibDocs.ContainsKey(libkey))
|
||||
d = Document.Get(ExistingLibDocs[libkey]); // found library document in existing database
|
||||
}
|
||||
}
|
||||
if (d == null) // not found in existing database, create it
|
||||
{
|
||||
|
Reference in New Issue
Block a user