Add separate counts for Errors, Warnings and Information
Cleanup memory after transition processing Adjusted width of Error Count Added memory usage to output Added Stored Procedure GetJustFormat Reduce Memory Use Removed extra using statement
This commit is contained in:
parent
508a86a8ac
commit
f5544b7053
@ -31,6 +31,7 @@ namespace DataLoader
|
||||
|
||||
private void MigrateLibDocs(OleDbConnection cn, string pth)
|
||||
{
|
||||
frmMain.AddInfo("Before MigrateLibDocs\r\n{0}", VEPROMS.CSLA.Library.CSLACache.UsageAll);
|
||||
// Get all of the library documents - the first list has the entire list of files
|
||||
// found within the rtffiles folder, the second list contains usages from the 'tran'
|
||||
// file. During processing for procedures/sections occurs, the used library documents
|
||||
@ -64,6 +65,7 @@ namespace DataLoader
|
||||
dicLibDocRef[key] = dicLibDocSect[dr_doc["TONUMBER"].ToString().ToUpper()];
|
||||
}
|
||||
da_doc.Dispose();
|
||||
frmMain.AddInfo("After MigrateLibDocs\r\n{0}", VEPROMS.CSLA.Library.CSLACache.UsageAll);
|
||||
}
|
||||
private int MigrateLibDoc(FileInfo fi)
|
||||
{
|
||||
|
@ -7378,6 +7378,42 @@ IF (@@Error = 0) PRINT 'Procedure Creation: getFormat Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: getFormat Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [getJustFormat] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getJustFormat]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [getJustFormat];
|
||||
GO
|
||||
|
||||
CREATE PROCEDURE [dbo].[getJustFormat]
|
||||
|
||||
(
|
||||
@FormatID int
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
SELECT
|
||||
[FormatID],
|
||||
[ParentID],
|
||||
[Name],
|
||||
[Description],
|
||||
[Data],
|
||||
[GenMac],
|
||||
[DTS],
|
||||
[UserID],
|
||||
[LastChanged],
|
||||
(SELECT COUNT(*) FROM [Contents] WHERE [Contents].[FormatID]=[Formats].[FormatID]) [ContentCount],
|
||||
(SELECT COUNT(*) FROM [DocVersions] WHERE [DocVersions].[FormatID]=[Formats].[FormatID]) [DocVersionCount],
|
||||
(SELECT COUNT(*) FROM [Folders] WHERE [Folders].[FormatID]=[Formats].[FormatID]) [FolderCount],
|
||||
(SELECT COUNT(*) FROM [Formats] [Children] WHERE [Children].[ParentID]=[Formats].[FormatID]) [ChildCount]
|
||||
FROM [Formats]
|
||||
WHERE [FormatID]=@FormatID
|
||||
|
||||
RETURN
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: getJustFormat Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: getJustFormat Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [getFormat] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getFormatByName]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [getFormatByName];
|
||||
|
@ -41,7 +41,9 @@ namespace DataLoader
|
||||
ProcFileName = dr["Entry"].ToString();
|
||||
ProcNumber = dr["Number"].ToString();
|
||||
frmMain.Status = "Processing Procedure " + ProcNumber + " - " + ProcFileName;
|
||||
|
||||
GC.Collect();
|
||||
frmMain.AddInfo("Processing Procedure {0} {1}", ProcNumber, GC.GetTotalMemory(true));
|
||||
//frmMain.MyInfo = CSLACache.UsageNotFinalized;
|
||||
|
||||
|
||||
DateTime dts = GetDTS(dr["Date"].ToString(), dr["Time"].ToString());
|
||||
@ -223,7 +225,6 @@ namespace DataLoader
|
||||
frmMain.AddError(ex, "MigrateProcedure - {0}", ProcFileName);
|
||||
}
|
||||
da.Dispose();
|
||||
|
||||
// dicSecCount is dictionary to track number of subsections for the parent at a level
|
||||
// dicSecID is the parent at that level
|
||||
Dictionary<int, int> dicSecCount = new Dictionary<int, int>();
|
||||
@ -286,6 +287,8 @@ namespace DataLoader
|
||||
}
|
||||
}
|
||||
dv.Dispose();
|
||||
//foreach (Item secItm in dicSecParentItem.Values)
|
||||
// secItm.Dispose();
|
||||
// need section start
|
||||
if (EditSectId != 0)
|
||||
{
|
||||
@ -378,8 +381,22 @@ namespace DataLoader
|
||||
{
|
||||
if (OKtoProcessDBF(dr)) // look for duplicate SET file info - jsj 2/11/10
|
||||
{
|
||||
List<int> cacheContentInfo = ContentInfo.CacheList;
|
||||
List<int> cacheItemInfo = ItemInfo.CacheList;
|
||||
List<int> cacheEntryInfo = EntryInfo.CacheList;
|
||||
List<int> cachePdfInfo = PdfInfo.CacheList;
|
||||
List<int> cacheDocVersionInfo = DocVersionInfo.CacheList;
|
||||
List<int> cachePartInfo = PartInfo.CacheList;
|
||||
FrItm = MigrateProcedure(cn, dr, FrItm, pth, docver, convertProcedures, activeFormat);
|
||||
if (FirstItm == null) FirstItm = FrItm;
|
||||
frmMain.MyInfo = string.Format("Before Restore {0}", GC.GetTotalMemory(true));
|
||||
ContentInfo.RestoreCacheList(cacheContentInfo);
|
||||
PartInfo.RestoreCacheList(cachePartInfo);
|
||||
ItemInfo.RestoreCacheList(cacheItemInfo);
|
||||
EntryInfo.RestoreCacheList(cacheEntryInfo);
|
||||
PdfInfo.RestoreCacheList(cachePdfInfo);
|
||||
DocVersionInfo.RestoreCacheList(cacheDocVersionInfo);
|
||||
frmMain.MyInfo = string.Format("After Restore {0}", GC.GetTotalMemory(true));
|
||||
}
|
||||
}
|
||||
//GC.Collect();
|
||||
@ -391,6 +408,10 @@ namespace DataLoader
|
||||
_MyLog.ErrorFormat("MigrateProcedures - {0} - {1}\r\n\r\n{2}", pth,ex.Message, ex.InnerException);
|
||||
//throw new Exception("Error in MigrateProcedures: " + pth, ex);
|
||||
}
|
||||
frmMain.MyInfo = CSLACache.UsageAll;
|
||||
frmMain.AddInfo(Content.MyStack);
|
||||
frmMain.AddInfo(ContentInfo.MyStack);
|
||||
frmMain.AddInfo(DocVersionInfo.MyStack);
|
||||
return FirstItm;
|
||||
}
|
||||
private void DbtOk(string fname, string pth)
|
||||
|
@ -117,7 +117,10 @@ namespace DataLoader
|
||||
string thenum = num.ToString("d2");
|
||||
fname = string.Format("{0}\\rtffiles\\{1}.A{2}", pth, ProcFileName, thenum);
|
||||
Application.DoEvents();
|
||||
SaveSectionDocument(fname, stpseq, SecType, ref Documentid, procitem.DisplayNumber + ":" + (Number == string.Empty ? Title : Number));
|
||||
string procnum = "";
|
||||
using (ItemInfo ii = ItemInfo.Get(procitem.ItemID))
|
||||
procnum = ii.DisplayNumber;
|
||||
SaveSectionDocument(fname, stpseq, SecType, ref Documentid, procnum + ":" + (Number == string.Empty ? Title : Number));
|
||||
if (Documentid == 0)
|
||||
{
|
||||
if (MissingDocument == null)
|
||||
@ -136,11 +139,11 @@ namespace DataLoader
|
||||
|
||||
// test for performance
|
||||
Content cont;
|
||||
using(Format fmt2 = format == null ? null : format.Get())
|
||||
Format fmt2 = format == null ? null : format.Get();
|
||||
cont = Content.New(Number, Title, 10000+docstyleindx, fmt2, ci==null?null:ci.ToString(), Dts, Userid);
|
||||
Entry entry = cont.MyEntry;
|
||||
if (needEntry)
|
||||
{
|
||||
Entry entry = cont.MyEntry;
|
||||
entry.MyDocument = Document.Get(Documentid);
|
||||
entry.DTS = Dts;
|
||||
entry.UserID = Userid;
|
||||
@ -560,7 +563,7 @@ namespace DataLoader
|
||||
{
|
||||
if (seciteminfo.MyContent.ContentEntryCount != 0)
|
||||
{
|
||||
using (DocumentInfo di = DocumentInfo.Get(secitem.MyContent.MyEntry.DocID))
|
||||
using (DocumentInfo di = seciteminfo.MyContent.MyEntry.MyDocument)
|
||||
{
|
||||
bool success = MSWordToPDF.UpdateDocPdf(di, OverrideColor, seciteminfo);
|
||||
if (!success)
|
||||
|
@ -180,14 +180,17 @@ namespace DataLoader
|
||||
}
|
||||
if (frType > 0)
|
||||
{
|
||||
parentItem.MyContent.ContentParts.Add(frType, item);
|
||||
if (!parentItem.MyContent.IsSavable) ErrorRpt.ErrorReport(parentItem.MyContent);
|
||||
parentItem.MyContent.Save();
|
||||
using (Content c = Content.Get(parentItem.ContentID))
|
||||
{
|
||||
c.ContentParts.Add(frType, item);
|
||||
if (!c.IsSavable) ErrorRpt.ErrorReport(c);
|
||||
c.Save();
|
||||
}
|
||||
}
|
||||
|
||||
// Remove styles that user entered but are automatically done via the format
|
||||
string tstr = null;
|
||||
using (ItemInfo myInfo = item.MyItemInfo) // do this so that ItemInfo doesn't stay in cashe
|
||||
using (ItemInfo myInfo = item.MyItemInfo) // do this so that ItemInfo doesn't stay in cache
|
||||
tstr = myInfo.RemoveRtfStyles(content.Text, fmt);
|
||||
if (tstr != content.Text)
|
||||
{
|
||||
|
@ -5,7 +5,6 @@ using Volian.Controls.Library;
|
||||
using VEPROMS.CSLA.Library;
|
||||
using System.Text.RegularExpressions;
|
||||
using Volian.Base.Library;
|
||||
using Volian.Controls.Library;
|
||||
using System.Xml;
|
||||
using System.IO;
|
||||
|
||||
|
@ -170,7 +170,7 @@ namespace DataLoader
|
||||
}
|
||||
}
|
||||
if (userid == null || userid == "") userid = "Migration";
|
||||
Transition tr = null;
|
||||
string results = null;
|
||||
try
|
||||
{
|
||||
int isRange = 0;
|
||||
@ -178,7 +178,8 @@ namespace DataLoader
|
||||
isRange = 1;
|
||||
else if (itype == 2)
|
||||
isRange = 2;
|
||||
tr = Transition.New(fromCon, toItem, toItem2, isRange, itype, ci != null ? ci.ToString() : null, dts, userid);
|
||||
using (Transition tr = Transition.New(fromCon, toItem, toItem2, isRange, itype, ci != null ? ci.ToString() : null, dts, userid))
|
||||
{
|
||||
//if (otranskey != null)
|
||||
// tr.MyZTransition.Oldto = otranskey; // info to finish outside transition processing later
|
||||
//else
|
||||
@ -187,6 +188,11 @@ namespace DataLoader
|
||||
tr.Save();
|
||||
if (migrationErrors.Count > 0)
|
||||
_ContentMigrationErrors.Add(fromCon.ContentID, migrationErrors);
|
||||
if (toItem.ItemID == toItem2.ItemID && itype != 2)
|
||||
results = string.Format(@"\v <START]\v0 (Resolved Transition Text)\v #Link:Transition:{0} {1} {2}[END>\v0 ", tr.TranType, tr.TransitionID, tr.ToID);
|
||||
else
|
||||
results = string.Format(@"\v <START]\v0 (Resolved Transition Text)\v #Link:TransitionRange:{0} {1} {2} {3}[END>\v0 ", tr.TranType, tr.TransitionID, tr.ToID, tr.RangeID);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -194,11 +200,6 @@ namespace DataLoader
|
||||
log.Error("Error addition transition record");
|
||||
log.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException);
|
||||
}
|
||||
string results = null;
|
||||
if (toItem.ItemID == toItem2.ItemID && itype != 2)
|
||||
results = string.Format(@"\v <START]\v0 (Resolved Transition Text)\v #Link:Transition:{0} {1} {2}[END>\v0 ", tr.TranType, tr.TransitionID, tr.ToID);
|
||||
else
|
||||
results = string.Format(@"\v <START]\v0 (Resolved Transition Text)\v #Link:TransitionRange:{0} {1} {2} {3}[END>\v0 ", tr.TranType, tr.TransitionID, tr.ToID, tr.RangeID);
|
||||
return results;
|
||||
}
|
||||
|
||||
|
2
PROMS/DataLoader/frmLoader.Designer.cs
generated
2
PROMS/DataLoader/frmLoader.Designer.cs
generated
@ -228,7 +228,7 @@ namespace DataLoader
|
||||
//
|
||||
this.tsslError.AutoSize = false;
|
||||
this.tsslError.Name = "tsslError";
|
||||
this.tsslError.Size = new System.Drawing.Size(300, 40);
|
||||
this.tsslError.Size = new System.Drawing.Size(150, 40);
|
||||
this.tsslError.Text = "No Errors";
|
||||
this.tsslError.TextAlign = System.Drawing.ContentAlignment.TopLeft;
|
||||
//
|
||||
|
@ -95,18 +95,18 @@ namespace DataLoader
|
||||
get { return tsslError.Text; }
|
||||
set
|
||||
{
|
||||
MyFrmErrors.Add(value);
|
||||
MyFrmErrors.Add(value, MessageType.Error);
|
||||
_MyLog.ErrorFormat(value);
|
||||
tsslError.Text = string.Format("{0} Errors", MyFrmErrors.MyErrors.Count); }
|
||||
tsslError.Text = string.Format("{0} Errors", MyFrmErrors.ErrorCount); }
|
||||
}
|
||||
public string MyWarning
|
||||
{
|
||||
get { return tsslError.Text; }
|
||||
set
|
||||
{
|
||||
MyFrmErrors.Add(value);
|
||||
MyFrmErrors.Add(value, MessageType.Warning);
|
||||
_MyLog.WarnFormat(value);
|
||||
tsslError.Text = string.Format("{0} Errors", MyFrmErrors.MyErrors.Count);
|
||||
//tsslError.Text = string.Format("{0} Errors", MyFrmErrors.ErrorCount);
|
||||
}
|
||||
}
|
||||
public string MyInfo
|
||||
@ -114,9 +114,9 @@ namespace DataLoader
|
||||
get { return tsslError.Text; }
|
||||
set
|
||||
{
|
||||
MyFrmErrors.Add(value);
|
||||
_MyLog.InfoFormat(value);
|
||||
tsslError.Text = string.Format("{0} Errors", MyFrmErrors.MyErrors.Count);
|
||||
MyFrmErrors.Add(value, MessageType.Information);
|
||||
_MyLog.Info(value);
|
||||
//tsslError.Text = string.Format("{0} Errors", MyFrmErrors.ErrorCount);
|
||||
}
|
||||
}
|
||||
public void AddError(string format, params object[] objs)
|
||||
@ -595,6 +595,11 @@ namespace DataLoader
|
||||
}
|
||||
private void btnFixTransitions_Click(object sender, EventArgs e)
|
||||
{
|
||||
List<int> cacheContentInfo = ContentInfo.CacheList;
|
||||
List<int> cacheItemInfo = ItemInfo.CacheList;
|
||||
//List<int> cacheEntryInfo = EntryInfo.CacheList;
|
||||
//List<int> cachePdfInfo = PdfInfo.CacheList;
|
||||
//List<int> cacheDocVersionInfo = DocVersionInfo.CacheList;
|
||||
//if (!CheckLogPath()) return;
|
||||
StepRTB rtb = new StepRTB();
|
||||
TransitionFixer myFixer = new TransitionFixer(rtb,MySettings.LogFilePath);
|
||||
@ -605,6 +610,12 @@ namespace DataLoader
|
||||
if(!ProcessComplete) MessageBox.Show(string.Format("{0}\r\n\n({1} Total Seconds)", TransFixTime, howlong.TotalSeconds));
|
||||
//MessageBox.Show(string.Format("Fix Transitions completion time: {0:D2}:{1:D2}:{2:D2}.{3}\r\n\n({4} Total Seconds)", howlong.Hours, howlong.Minutes, howlong.Seconds, howlong.Milliseconds, howlong.TotalSeconds));
|
||||
CreateBackupRestoreBatchFiles();
|
||||
ItemInfo.RestoreCacheList(cacheItemInfo);
|
||||
ContentInfo.RestoreCacheList(cacheContentInfo);
|
||||
//EntryInfo.RestoreCacheList(cacheEntryInfo);
|
||||
//PdfInfo.RestoreCacheList(cachePdfInfo);
|
||||
//DocVersionInfo.RestoreCacheList(cacheDocVersionInfo);
|
||||
MyInfo = CSLACache.UsageAll;
|
||||
}
|
||||
|
||||
void myFixer_StatusChanged(object sender, TransitionFixerEventArgs args)
|
||||
@ -641,7 +652,7 @@ namespace DataLoader
|
||||
if (TextConvert.MyGlitches.Glitches.Count > 0)
|
||||
TextConvert.MyGlitches.Save(MySettings.LogFilePath + @"\ConversionGlitches.xml");
|
||||
// Save the Error Log
|
||||
if (_MyFrmErrors.ItemCount() > 0)
|
||||
if (_MyFrmErrors.ErrorCount > 0)
|
||||
_MyFrmErrors.Save(MySettings.LogFilePath + @"\ConversionErrors.txt");
|
||||
}
|
||||
|
||||
@ -731,6 +742,8 @@ namespace DataLoader
|
||||
mb.Append("Backup Complete");
|
||||
Status = "Processing Complete";
|
||||
ProcessComplete = false;
|
||||
Clipboard.Clear();
|
||||
Clipboard.SetText(mb.ToString());
|
||||
MessageBox.Show(mb.ToString(), "Processing Complete", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
private void ConvertToChangeManager()
|
||||
@ -885,12 +898,14 @@ namespace DataLoader
|
||||
}
|
||||
public void Append(string format, params object [] args)
|
||||
{
|
||||
string msg = "\r\n" + string.Format(format,args);
|
||||
string msg = string.Format(format,args);
|
||||
DateTime now = DateTime.Now;
|
||||
TimeSpan ts = TimeSpan.FromTicks(now.Ticks - _LastTime.Ticks);
|
||||
string timestamp = string.Format("{0:D2}:{1:D2}:{2:D2}.{3:D3}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds);
|
||||
_LastTime = now;
|
||||
_MyStringBulider.Append("\r\n" + timestamp + " " + msg);
|
||||
GC.Collect();
|
||||
long memUse = GC.GetTotalMemory(true);
|
||||
_MyStringBulider.Append("\r\n" + timestamp + "\t" + memUse.ToString() + "\t" + msg);
|
||||
}
|
||||
public override string ToString()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user