Enhanced: CSLA interface for vesp_GetNonEnhancedDocVersions (gets list of non-linked doc versions)

This commit is contained in:
Kathy Ruffing 2016-05-09 11:28:09 +00:00
parent 973180d8d6
commit 37ffe8dd7b

View File

@ -20,7 +20,7 @@ using System.Threading;
namespace VEPROMS.CSLA.Library namespace VEPROMS.CSLA.Library
{ {
public partial class DocVersion: IVEDrillDown public partial class DocVersion : IVEDrillDown
{ {
public bool NewerRoFst public bool NewerRoFst
{ {
@ -182,7 +182,7 @@ namespace VEPROMS.CSLA.Library
exists = false; exists = false;
t.Abort(); t.Abort();
if (tsTimeOut > TimeSpan.FromSeconds(1)) if (tsTimeOut > TimeSpan.FromSeconds(1))
tsTimeOut = TimeSpan.FromTicks( tsTimeOut.Ticks / 2); tsTimeOut = TimeSpan.FromTicks(tsTimeOut.Ticks / 2);
} }
return exists; return exists;
} }
@ -368,7 +368,7 @@ namespace VEPROMS.CSLA.Library
string sav = str.Substring(len); string sav = str.Substring(len);
str = str.Substring(0, len); str = str.Substring(0, len);
string substr = str.Substring(2); string substr = str.Substring(2);
substr = substr.Replace(" ",""); substr = substr.Replace(" ", "");
while (swptr >= 0 && swptr < swhir.Length && retval == null) //retval.Equals(string.Empty)) while (swptr >= 0 && swptr < swhir.Length && retval == null) //retval.Equals(string.Empty))
{ {
switch (swhir[swptr]) switch (swhir[swptr])
@ -390,7 +390,7 @@ namespace VEPROMS.CSLA.Library
break; break;
case 'S': case 'S':
//retval = GetProfile("Procedure_Set", substr, true); //retval = GetProfile("Procedure_Set", substr, true);
if(substr.ToLower() == "id") if (substr.ToLower() == "id")
retval = this.DocVersionConfig.Unit_ProcedureSetID; retval = this.DocVersionConfig.Unit_ProcedureSetID;
if (substr.ToLower() == "name") if (substr.ToLower() == "name")
retval = this.DocVersionConfig.Unit_ProcedureSetName; retval = this.DocVersionConfig.Unit_ProcedureSetName;
@ -457,10 +457,10 @@ namespace VEPROMS.CSLA.Library
l -= cnt; l -= cnt;
str = str.Substring(ptr); 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); cnt = ptr; //(int)(ptr - str);
//add(new seUser(str + 1, cnt - 2)); //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; l -= cnt;
str = str.Substring(ptr); //ptr; str = str.Substring(ptr); //ptr;
} }
@ -507,11 +507,12 @@ namespace VEPROMS.CSLA.Library
} }
public FormatInfo ActiveFormat public FormatInfo ActiveFormat
{ {
get {return LocalFormat != null ? LocalFormat : ActiveParent.ActiveFormat;} get { return LocalFormat != null ? LocalFormat : ActiveParent.ActiveFormat; }
} }
public FormatInfo LocalFormat 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); //Console.WriteLine("DV Local {0} {1} {2}", (MyFormat == null) ? "MYformat is null" : MyFormat.Name,FormatID,(MyFormat == null)?0:MyFormat.FormatID);
return MyFormat; return MyFormat;
} }
@ -651,8 +652,8 @@ namespace VEPROMS.CSLA.Library
{ {
if (DocVersionAssociations == null || DocVersionAssociations.Count == 0) // No RO Association for this Data if (DocVersionAssociations == null || DocVersionAssociations.Count == 0) // No RO Association for this Data
{ {
if(FirstBadRODBIDProblemDetected) if (FirstBadRODBIDProblemDetected)
_MyLog.ErrorFormat("<<<ERROR>>> - Missing RO Association\r\nMissing RO Association for this Folder ([{0}] - {1})",VersionID, MyFolder.Name); _MyLog.ErrorFormat("<<<ERROR>>> - Missing RO Association\r\nMissing RO Association for this Folder ([{0}] - {1})", VersionID, MyFolder.Name);
return null; return null;
} }
foreach (AssociationInfo dva in DocVersionAssociations) foreach (AssociationInfo dva in DocVersionAssociations)
@ -732,7 +733,7 @@ namespace VEPROMS.CSLA.Library
{ {
if (_UnitNames == null) if (_UnitNames == null)
{ {
// _UnitNames = DocVersionConfig.Unit_Name.Split(','); _UnitNames = DocVersionConfig.Unit_Name.Split(',');
_UnitNames = new string[DocVersionConfig.Unit_Count]; _UnitNames = new string[DocVersionConfig.Unit_Count];
int j = 0; int j = 0;
for (int k = 1; k <= DocVersionConfig.MaxSlaveIndex; k++) for (int k = 1; k <= DocVersionConfig.MaxSlaveIndex; k++)
@ -798,4 +799,59 @@ namespace VEPROMS.CSLA.Library
{ {
WorkingDraft = 0, Temporary = 1, Revision = 128, Approved = 129 WorkingDraft = 0, Temporary = 1, Revision = 128, Approved = 129
} }
public partial class DocVersionInfoList
{
public static DocVersionInfoList GetNonEnhancedDocVersions()
{
try
{
DocVersionInfoList tmp = DataPortal.Fetch<DocVersionInfoList>(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;
}
}
} }