diff --git a/PROMS/DataLoader/Sections.cs b/PROMS/DataLoader/Sections.cs index 0234c1fd..235b4488 100644 --- a/PROMS/DataLoader/Sections.cs +++ b/PROMS/DataLoader/Sections.cs @@ -139,7 +139,7 @@ namespace DataLoader // test for performance Content cont; - Format fmt2 = format == null ? null : format.Get(); + Format fmt2 = format == null ? null : format.GetJustFormat(); cont = Content.New(Number, Title, 10000+docstyleindx, fmt2, ci==null?null:ci.ToString(), Dts, Userid); if (needEntry) { diff --git a/PROMS/DataLoader/Steps.cs b/PROMS/DataLoader/Steps.cs index 9b9a56ec..3c4b90bd 100644 --- a/PROMS/DataLoader/Steps.cs +++ b/PROMS/DataLoader/Steps.cs @@ -180,12 +180,15 @@ namespace DataLoader } if (frType > 0) { - using (Content c = Content.Get(parentItem.ContentID)) - { - c.ContentParts.Add(frType, item); - if (!c.IsSavable) ErrorRpt.ErrorReport(c); - c.Save(); - } + //using (Content c = Content.Get(parentItem.ContentID)) + //{ + // c.ContentParts.Add(frType, item); + // if (!c.IsSavable) ErrorRpt.ErrorReport(c); + // c.Save(); + //} + parentItem.MyContent.ContentParts.Add(frType, item); + if (!parentItem.MyContent.IsSavable) ErrorRpt.ErrorReport(parentItem.MyContent); + parentItem.MyContent.Save(); } // Remove styles that user entered but are automatically done via the format diff --git a/PROMS/DataLoader/frmErrors.cs b/PROMS/DataLoader/frmErrors.cs index d8772606..3e98ac19 100644 --- a/PROMS/DataLoader/frmErrors.cs +++ b/PROMS/DataLoader/frmErrors.cs @@ -17,7 +17,6 @@ namespace DataLoader InitializeComponent(); _MyParent = myParent; } - private List _MyMessages = new List(); private int _ErrorCount = 0; public int ErrorCount @@ -54,7 +53,6 @@ namespace DataLoader default: break; } - _MyMessages.Add(err); tbErrors.SelectionStart = tbErrors.TextLength; tbErrors.SelectedText = sep + err; sep = "\r\n"; @@ -75,9 +73,8 @@ namespace DataLoader } public void Save(string path) { - StreamWriter fs = new StreamWriter(path,false); - foreach (string txt in _MyMessages) - fs.WriteLine(txt); + StreamWriter fs = new StreamWriter(path, false); + fs.Write(tbErrors.Text); fs.Close(); } } diff --git a/PROMS/DataLoader/frmLoader.cs b/PROMS/DataLoader/frmLoader.cs index 4febd3fd..b26116a3 100644 --- a/PROMS/DataLoader/frmLoader.cs +++ b/PROMS/DataLoader/frmLoader.cs @@ -744,6 +744,7 @@ namespace DataLoader ProcessComplete = false; Clipboard.Clear(); Clipboard.SetText(mb.ToString()); + AddInfo(mb.ToString()); MessageBox.Show(mb.ToString(), "Processing Complete", MessageBoxButtons.OK, MessageBoxIcon.Information); } private void ConvertToChangeManager() diff --git a/PROMS/VEPROMS.CSLA.Library/Config/SectionConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/SectionConfig.cs index 9d02d5d9..6088df02 100644 --- a/PROMS/VEPROMS.CSLA.Library/Config/SectionConfig.cs +++ b/PROMS/VEPROMS.CSLA.Library/Config/SectionConfig.cs @@ -190,7 +190,7 @@ namespace VEPROMS.CSLA.Library set { if (_Section != null) - _Section.MyContent.MyFormat = value == null ? null : value.Get(); + _Section.MyContent.MyFormat = value == null ? null : value.GetJustFormat(); } } [Category("Format")] diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/FormatExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/FormatExt.cs index e2446bc0..9f54fc3f 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/FormatExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/FormatExt.cs @@ -316,6 +316,10 @@ namespace VEPROMS.CSLA.Library } public partial class FormatInfo : IFormatOrFormatInfo { + public virtual Format GetJustFormat() + { + return _Editable = Format.GetJustFormat(_FormatID); + } public static bool HasLatestChanges() { if (!HasSeqTabFmtTabToken()) return false; diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs index d712d9fa..daaf939e 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs @@ -423,9 +423,9 @@ namespace VEPROMS.CSLA.Library using(TransitionInfoList trans = TransitionInfoList.GetAffected(this.ItemID)) { #region B2012-071 fix JCB - Content oldContent = null; foreach (TransitionInfo tran in trans) { + Content oldContent = null; using (Content content = tran.MyContent.Get()) { if (oldContent != null && content.ContentID != oldContent.ContentID) @@ -449,21 +449,22 @@ namespace VEPROMS.CSLA.Library // content.DTS = DateTime.Now; // content.Save(); //} + if (oldContent != null) + { + if (oldContent.IsDirty) + { + oldContent.DTS = DateTime.Now; + #region B2012-079 fix JCB + oldContent.UserID = Volian.Base.Library.VlnSettings.UserID + " - Renumber"; + #endregion B2012-079 fix JCB + oldContent.Save(); + } + else // Update ContentInfo objects to reflect the change in the transition + ContentInfo.Refresh(oldContent); + } } } - if (oldContent != null) - { - if (oldContent.IsDirty) - { - oldContent.DTS = DateTime.Now; - #region B2012-079 fix JCB - oldContent.UserID = Volian.Base.Library.VlnSettings.UserID + " - Renumber"; - #endregion B2012-079 fix JCB - oldContent.Save(); - } - else // Update ContentInfo objects to reflect the change in the transition - ContentInfo.Refresh(oldContent); - } + #endregion B2012-071 fix JCB } } diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/Content.cs b/PROMS/VEPROMS.CSLA.Library/Generated/Content.cs index bca30e14..874c7e36 100644 --- a/PROMS/VEPROMS.CSLA.Library/Generated/Content.cs +++ b/PROMS/VEPROMS.CSLA.Library/Generated/Content.cs @@ -209,12 +209,14 @@ namespace VEPROMS.CSLA.Library [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)] get { + if (Disposed) throw new Exception("Attempt to access Disposed Object"); CanReadProperty("Text", true); return _Text; } [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)] set { + if (Disposed) throw new Exception("Attempt to access Disposed Object"); CanWriteProperty("Text", true); if (value == null) value = string.Empty; if (_Text != value) @@ -883,13 +885,49 @@ namespace VEPROMS.CSLA.Library if (_Disposed) return; _CountDisposed++; _Disposed = true; + RemoveFromDictionaries(); + if (_MyZContent != null) // 9.79 + { + _MyZContent.Dispose(); + _MyZContent = null; + } + if (_ContentParts != null) // 8.93 + { + foreach (ContentPart cp in _ContentParts) + cp.Dispose(); + _ContentParts = null; + } + if (_MyEntry != null) // .465 + { + _MyEntry.Dispose(); + _MyEntry = null; + } if (_MyGrid != null) { _MyGrid.Dispose(); _MyGrid = null; } - Disposed = true; - RemoveFromDictionaries(); + _Text = null; + //if (_ContentDetails != null) + // _ContentDetails = null; + //if (_ContentItems != null) + //{ + // _ContentItems = null; + // //foreach (ContentItem ci in _ContentItems) + // // ci.Dispose(); + //} + //if (_ContentRoUsages != null) + //{ + // //foreach (ContentRoUsage cr in _ContentRoUsages) + // // cr.Dispose(); + // _ContentRoUsages = null; + //} + //if (_ContentTransitions != null) + //{ + // foreach (ContentTransition ct in _ContentTransitions) + // ct.Dispose(); + // _ContentTransitions = null; + //} } private void RemoveFromDictionaries() { diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/ContentInfo.cs b/PROMS/VEPROMS.CSLA.Library/Generated/ContentInfo.cs index 8672a5a6..e0c8d162 100644 --- a/PROMS/VEPROMS.CSLA.Library/Generated/ContentInfo.cs +++ b/PROMS/VEPROMS.CSLA.Library/Generated/ContentInfo.cs @@ -136,6 +136,7 @@ namespace VEPROMS.CSLA.Library [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)] get { + if (_Disposed) throw new Exception("Cannot access disposed object"); CanReadProperty("Text", true); return _Text; } @@ -573,6 +574,25 @@ namespace VEPROMS.CSLA.Library while (listContentInfo.Contains(this)) listContentInfo.Remove(this); // Remove the item from the list if (listContentInfo.Count == 0) // If there are no items left in the list _CacheByPrimaryKey.Remove(ContentID.ToString()); // remove the list + if (_Editable != null) + _Editable = null; + if (_ContentItems != null) + _ContentItems = null; + _Text = null; + //if (_ContentParts != null) + // _ContentParts = null; + //if (_ContentRoUsages != null) + // _ContentRoUsages = null; + //if (_ContentTransitions != null) + // _ContentTransitions = null; + //if (_MyEntry != null) + // _MyEntry = null; + //if (_MyGrid != null) + // _MyGrid = null; + //if (_MyImage != null) + // _MyImage = null; + //if (_MyZContent != null) + // _MyZContent = null; } public virtual Content Get() { diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/Database.cs b/PROMS/VEPROMS.CSLA.Library/Generated/Database.cs index e8da4f0d..1d62994b 100644 --- a/PROMS/VEPROMS.CSLA.Library/Generated/Database.cs +++ b/PROMS/VEPROMS.CSLA.Library/Generated/Database.cs @@ -131,7 +131,7 @@ namespace VEPROMS.CSLA.Library SqlConnection cn = new SqlConnection(tmp); cn.Open(); // SqlDataAdapter da = new SqlDataAdapter("select name from sysdatabases where name like 'VEP%' order by name", cn); - SqlDataAdapter da = new SqlDataAdapter("select name, case when object_id(name + '..Items') is null then 'Not PROMS' when object_id(name + '..Revisions') is not null then 'Approval' when object_id(name + '..ContentAudits') is not null then 'Change Manager' else 'Original' end functionality from sysdatabases where name not in ('master','model','msdb','tempdb') order by name", cn); + SqlDataAdapter da = new SqlDataAdapter("select name, case when object_id('[' + name + ']..Items') is null then 'Not PROMS' when object_id('[' + name + ']..Revisions') is not null then 'Approval' when object_id('[' + name + ']..ContentAudits') is not null then 'Change Manager' else 'Original' end functionality from sysdatabases where name not in ('master','model','msdb','tempdb') order by name", cn); DataSet ds = new DataSet(); da.Fill(ds); cn.Close(); diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/Item.cs b/PROMS/VEPROMS.CSLA.Library/Generated/Item.cs index 91e23993..daad6266 100644 --- a/PROMS/VEPROMS.CSLA.Library/Generated/Item.cs +++ b/PROMS/VEPROMS.CSLA.Library/Generated/Item.cs @@ -734,12 +734,26 @@ namespace VEPROMS.CSLA.Library if (_Disposed) return; _CountDisposed++; _Disposed = true; + RemoveFromDictionaries(); if (_MyContent != null) { _MyContent.Dispose(); _MyContent = null; } - RemoveFromDictionaries(); + if (_ItemTransitions_RangeID != null) + _ItemTransitions_RangeID = null; + if (_ItemTransitions_ToID != null) + _ItemTransitions_ToID = null; + //if (_MyPrevious != null) + // _MyPrevious = null; + //if (_NextItems != null) + // _NextItems = null; + //if (_ItemAnnotations != null) + // _ItemAnnotations.Dispose(); + //if (_ItemDocVersions != null) + // _ItemDocVersions = null; + //if (_ItemParts != null) + // _ItemParts = null; } private void RemoveFromDictionaries() { @@ -787,7 +801,7 @@ namespace VEPROMS.CSLA.Library { Item tmp2 = tmp; tmp = tmp2.Save(); - tmp2.Dispose(); + //tmp2.Dispose(); } else { diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/ItemInfo.cs b/PROMS/VEPROMS.CSLA.Library/Generated/ItemInfo.cs index 758baf12..49d5760b 100644 --- a/PROMS/VEPROMS.CSLA.Library/Generated/ItemInfo.cs +++ b/PROMS/VEPROMS.CSLA.Library/Generated/ItemInfo.cs @@ -450,6 +450,20 @@ namespace VEPROMS.CSLA.Library while (listItemInfo.Contains(this)) listItemInfo.Remove(this); // Remove the item from the list if (listItemInfo.Count == 0) // If there are no items left in the list _CacheByPrimaryKey.Remove(ItemID.ToString()); // remove the list + if (_MyContent != null) + _MyContent = null; + if (_MyPrevious != null) + _MyPrevious = null; + //if (_ActiveFormat != null) + // _ActiveFormat = null; + //if (_ActiveParent != null) + // _ActiveParent = null; + //if (_ActiveSection != null) + // _ActiveSection = null; + //if (_MyDocVersion != null) + // _MyDocVersion = null; + //if (_ParentNoteOrCaution != null) + // _ParentNoteOrCaution = null; } public virtual Item Get() { diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/ItemInfoList.cs b/PROMS/VEPROMS.CSLA.Library/Generated/ItemInfoList.cs index 1e45256f..c1901d1d 100644 --- a/PROMS/VEPROMS.CSLA.Library/Generated/ItemInfoList.cs +++ b/PROMS/VEPROMS.CSLA.Library/Generated/ItemInfoList.cs @@ -92,6 +92,7 @@ namespace VEPROMS.CSLA.Library foreach (ItemInfo tmp in this) { tmp.Changed -= new ItemInfoEvent(tmp_Changed); + tmp.Deleted -= new ItemInfoEvent(tmp_Deleted); } } #endregion diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/Transition.cs b/PROMS/VEPROMS.CSLA.Library/Generated/Transition.cs index 85782ed7..89732e87 100644 --- a/PROMS/VEPROMS.CSLA.Library/Generated/Transition.cs +++ b/PROMS/VEPROMS.CSLA.Library/Generated/Transition.cs @@ -594,6 +594,19 @@ namespace VEPROMS.CSLA.Library _CountDisposed++; _Disposed = true; RemoveFromDictionaries(); + if (_MyZTransition != null) + { + _MyZTransition.Dispose(); + _MyZTransition = null; + } + if (_MyContent != null) + _MyContent = null; + //if (_MyItemRangeID!=null) + // _MyItemRangeID = null; + //if (_MyItemToID != null) + // _MyItemToID = null; + //if (_MyItemRangeID != null) + // _MyItemRangeID = null; } private void RemoveFromDictionaries() { diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/ZTransition.cs b/PROMS/VEPROMS.CSLA.Library/Generated/ZTransition.cs index 3258b8bd..32413e93 100644 --- a/PROMS/VEPROMS.CSLA.Library/Generated/ZTransition.cs +++ b/PROMS/VEPROMS.CSLA.Library/Generated/ZTransition.cs @@ -310,6 +310,8 @@ namespace VEPROMS.CSLA.Library _CountDisposed++; _Disposed = true; RemoveFromDictionaries(); + if (_MyTransition != null) + _MyTransition = null; } private void RemoveFromDictionaries() {