diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/DocVersionExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/DocVersionExt.cs index 8b3b6c9a..926f6ff3 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/DocVersionExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/DocVersionExt.cs @@ -20,7 +20,7 @@ using System.Threading; namespace VEPROMS.CSLA.Library { - public partial class DocVersion: IVEDrillDown + public partial class DocVersion : IVEDrillDown { public bool NewerRoFst { @@ -177,12 +177,12 @@ namespace VEPROMS.CSLA.Library ); t.Start(); bool completed = t.Join(tsTimeOut); //wait 6 seconds then 3 then 1.5 then .75 seconds - if (!completed) - { - exists = false; + if (!completed) + { + exists = false; t.Abort(); if (tsTimeOut > TimeSpan.FromSeconds(1)) - tsTimeOut = TimeSpan.FromTicks( tsTimeOut.Ticks / 2); + tsTimeOut = TimeSpan.FromTicks(tsTimeOut.Ticks / 2); } return exists; } @@ -245,7 +245,7 @@ namespace VEPROMS.CSLA.Library } } public string SearchPath { get { return ""; } } - #endregion + #endregion #region DocVersion Config [NonSerialized] @@ -368,7 +368,7 @@ namespace VEPROMS.CSLA.Library string sav = str.Substring(len); str = str.Substring(0, len); string substr = str.Substring(2); - substr = substr.Replace(" ",""); + substr = substr.Replace(" ", ""); while (swptr >= 0 && swptr < swhir.Length && retval == null) //retval.Equals(string.Empty)) { switch (swhir[swptr]) @@ -390,7 +390,7 @@ namespace VEPROMS.CSLA.Library break; case 'S': //retval = GetProfile("Procedure_Set", substr, true); - if(substr.ToLower() == "id") + if (substr.ToLower() == "id") retval = this.DocVersionConfig.Unit_ProcedureSetID; if (substr.ToLower() == "name") retval = this.DocVersionConfig.Unit_ProcedureSetName; @@ -457,10 +457,10 @@ namespace VEPROMS.CSLA.Library l -= cnt; str = str.Substring(ptr); } - ptr = str.IndexOf('>')+1; //nextDelimiter(">", str, l) + 1; + ptr = str.IndexOf('>') + 1; //nextDelimiter(">", str, l) + 1; cnt = ptr; //(int)(ptr - str); //add(new seUser(str + 1, cnt - 2)); - rtnstr += Evaluate(str.Substring(1, cnt - 2),cnt-2); + rtnstr += Evaluate(str.Substring(1, cnt - 2), cnt - 2); l -= cnt; str = str.Substring(ptr); //ptr; } @@ -507,11 +507,12 @@ namespace VEPROMS.CSLA.Library } public FormatInfo ActiveFormat { - get {return LocalFormat != null ? LocalFormat : ActiveParent.ActiveFormat;} + get { return LocalFormat != null ? LocalFormat : ActiveParent.ActiveFormat; } } public FormatInfo LocalFormat { - get { + get + { //Console.WriteLine("DV Local {0} {1} {2}", (MyFormat == null) ? "MYformat is null" : MyFormat.Name,FormatID,(MyFormat == null)?0:MyFormat.FormatID); return MyFormat; } @@ -522,7 +523,7 @@ namespace VEPROMS.CSLA.Library } //public bool HasStandardSteps() //{ return false; } - #region PasteChild + #region PasteChild public ItemInfo PasteChild(int copyStartID) // pastes into an 'empty' docversion { ItemInfo cpItem = ItemInfo.Get(copyStartID); @@ -651,8 +652,8 @@ namespace VEPROMS.CSLA.Library { if (DocVersionAssociations == null || DocVersionAssociations.Count == 0) // No RO Association for this Data { - if(FirstBadRODBIDProblemDetected) - _MyLog.ErrorFormat("<<>> - Missing RO Association\r\nMissing RO Association for this Folder ([{0}] - {1})",VersionID, MyFolder.Name); + if (FirstBadRODBIDProblemDetected) + _MyLog.ErrorFormat("<<>> - Missing RO Association\r\nMissing RO Association for this Folder ([{0}] - {1})", VersionID, MyFolder.Name); return null; } foreach (AssociationInfo dva in DocVersionAssociations) @@ -680,7 +681,7 @@ namespace VEPROMS.CSLA.Library { if (_HasBadRODBIDProblem.Contains(VersionID)) return false; _HasBadRODBIDProblem.Add(VersionID); - return true; + return true; } } public bool IsFolder @@ -732,7 +733,7 @@ namespace VEPROMS.CSLA.Library { if (_UnitNames == null) { -// _UnitNames = DocVersionConfig.Unit_Name.Split(','); + _UnitNames = DocVersionConfig.Unit_Name.Split(','); _UnitNames = new string[DocVersionConfig.Unit_Count]; int j = 0; for (int k = 1; k <= DocVersionConfig.MaxSlaveIndex; k++) @@ -798,4 +799,59 @@ namespace VEPROMS.CSLA.Library { WorkingDraft = 0, Temporary = 1, Revision = 128, Approved = 129 } + public partial class DocVersionInfoList + { + public static DocVersionInfoList GetNonEnhancedDocVersions() + { + try + { + DocVersionInfoList tmp = DataPortal.Fetch(new DocVersionNonEnhancedListCriteria()); + DocVersionInfo.AddList(tmp); + tmp.AddEvents(); + return tmp; + } + catch (Exception ex) + { + throw new DbCslaException("Error on DocVersionInfoList.GetNonEnhancedDocVersions", ex); + } + } + + [Serializable()] + protected class DocVersionNonEnhancedListCriteria + { + public DocVersionNonEnhancedListCriteria() { ;} + } + private void DataPortal_Fetch(DocVersionNonEnhancedListCriteria criteria) + { + this.RaiseListChangedEvents = false; + try + { + using (SqlConnection cn = Database.VEPROMS_SqlConnection) + { + using (SqlCommand cm = cn.CreateCommand()) + { + cm.CommandType = CommandType.StoredProcedure; + cm.CommandText = "vesp_GetNonEnhancedDocVersions"; + cm.CommandTimeout = Database.DefaultTimeout; + using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader())) + { + IsReadOnly = false; + while (dr.Read()) + { + DocVersionInfo dvInfo = new DocVersionInfo(dr); + this.Add(dvInfo); + } + IsReadOnly = true; + } + } + } + } + catch (Exception ex) + { + Database.LogException("DocVersionInfoList.DataPortal_Fetch", ex); + throw new DbCslaException("DocVersionInfoList.DataPortal_Fetch", ex); + } + this.RaiseListChangedEvents = true; + } + } }