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

@ -511,7 +511,8 @@ namespace VEPROMS.CSLA.Library
}
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;
}
@ -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<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;
}
}
}