This commit is contained in:
parent
55166e2cb3
commit
a95b610d3f
@ -75,6 +75,10 @@ namespace VEPROMS.CSLA.Library
|
||||
// { public override string ToString() { return string.Format("{0}", _Name); } }
|
||||
// public partial class AssignmentInfo
|
||||
// { public override string ToString() { return string.Format("{0}", _Name); } }
|
||||
// public partial class Association
|
||||
// { public override string ToString() { return string.Format("{0}", _Name); } }
|
||||
// public partial class AssociationInfo
|
||||
// { public override string ToString() { return string.Format("{0}", _Name); } }
|
||||
// public partial class Connection
|
||||
// { public override string ToString() { return string.Format("{0}", _Name); } }
|
||||
// public partial class ConnectionFolder
|
||||
@ -107,12 +111,18 @@ namespace VEPROMS.CSLA.Library
|
||||
// { public override string ToString() { return string.Format("{0}", _Name); } }
|
||||
// public partial class DocVersion
|
||||
// { public override string ToString() { return string.Format("{0}", _Name); } }
|
||||
// public partial class DocVersionAssociation
|
||||
// { public override string ToString() { return string.Format("{0}", _Name); } }
|
||||
// public partial class DocVersionInfo
|
||||
// { public override string ToString() { return string.Format("{0}", _Name); } }
|
||||
// public partial class Entry
|
||||
// { public override string ToString() { return string.Format("{0}", _Name); } }
|
||||
// public partial class EntryInfo
|
||||
// { public override string ToString() { return string.Format("{0}", _Name); } }
|
||||
// public partial class Figure
|
||||
// { public override string ToString() { return string.Format("{0}", _Name); } }
|
||||
// public partial class FigureInfo
|
||||
// { public override string ToString() { return string.Format("{0}", _Name); } }
|
||||
// public partial class Folder
|
||||
// { public override string ToString() { return string.Format("{0}", _Name); } }
|
||||
// public partial class FolderAssignment
|
||||
@ -165,6 +175,30 @@ namespace VEPROMS.CSLA.Library
|
||||
// { public override string ToString() { return string.Format("{0}", _Name); } }
|
||||
// public partial class PermissionInfo
|
||||
// { public override string ToString() { return string.Format("{0}", _Name); } }
|
||||
// public partial class RODb
|
||||
// { public override string ToString() { return string.Format("{0}", _Name); } }
|
||||
// public partial class RODbROFst
|
||||
// { public override string ToString() { return string.Format("{0}", _Name); } }
|
||||
// public partial class RODbROImage
|
||||
// { public override string ToString() { return string.Format("{0}", _Name); } }
|
||||
// public partial class RODbRoUsage
|
||||
// { public override string ToString() { return string.Format("{0}", _Name); } }
|
||||
// public partial class RODbInfo
|
||||
// { public override string ToString() { return string.Format("{0}", _Name); } }
|
||||
// public partial class ROFst
|
||||
// { public override string ToString() { return string.Format("{0}", _Name); } }
|
||||
// public partial class ROFstAssociation
|
||||
// { public override string ToString() { return string.Format("{0}", _Name); } }
|
||||
// public partial class ROFstFigure
|
||||
// { public override string ToString() { return string.Format("{0}", _Name); } }
|
||||
// public partial class ROFstInfo
|
||||
// { public override string ToString() { return string.Format("{0}", _Name); } }
|
||||
// public partial class ROImage
|
||||
// { public override string ToString() { return string.Format("{0}", _Name); } }
|
||||
// public partial class ROImageFigure
|
||||
// { public override string ToString() { return string.Format("{0}", _Name); } }
|
||||
// public partial class ROImageInfo
|
||||
// { public override string ToString() { return string.Format("{0}", _Name); } }
|
||||
// public partial class Role
|
||||
// { public override string ToString() { return string.Format("{0}", _Name); } }
|
||||
// public partial class RoleAssignment
|
||||
|
1360
PROMS/VEPROMS.CSLA.Library/Generated/RODb.cs
Normal file
1360
PROMS/VEPROMS.CSLA.Library/Generated/RODb.cs
Normal file
File diff suppressed because it is too large
Load Diff
476
PROMS/VEPROMS.CSLA.Library/Generated/RODbInfo.cs
Normal file
476
PROMS/VEPROMS.CSLA.Library/Generated/RODbInfo.cs
Normal file
@ -0,0 +1,476 @@
|
||||
// ========================================================================
|
||||
// Copyright 2007 - Volian Enterprises, Inc. All rights reserved.
|
||||
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||
// ------------------------------------------------------------------------
|
||||
// $Workfile: $ $Revision: $
|
||||
// $Author: $ $Date: $
|
||||
//
|
||||
// $History: $
|
||||
// ========================================================================
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using Csla;
|
||||
using Csla.Data;
|
||||
using System.Configuration;
|
||||
using System.IO;
|
||||
using System.ComponentModel;
|
||||
using System.Collections.Generic;
|
||||
namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
public delegate void RODbInfoEvent(object sender);
|
||||
/// <summary>
|
||||
/// RODbInfo Generated by MyGeneration using the CSLA Object Mapping template
|
||||
/// </summary>
|
||||
[Serializable()]
|
||||
[TypeConverter(typeof(RODbInfoConverter))]
|
||||
public partial class RODbInfo : ReadOnlyBase<RODbInfo>, IDisposable
|
||||
{
|
||||
public event RODbInfoEvent Changed;
|
||||
private void OnChange()
|
||||
{
|
||||
if (Changed != null) Changed(this);
|
||||
}
|
||||
#region Log4Net
|
||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
#endregion
|
||||
#region Collection
|
||||
private static List<RODbInfo> _CacheList = new List<RODbInfo>();
|
||||
protected static void AddToCache(RODbInfo rODbInfo)
|
||||
{
|
||||
if (!_CacheList.Contains(rODbInfo)) _CacheList.Add(rODbInfo); // In AddToCache
|
||||
}
|
||||
protected static void RemoveFromCache(RODbInfo rODbInfo)
|
||||
{
|
||||
while (_CacheList.Contains(rODbInfo)) _CacheList.Remove(rODbInfo); // In RemoveFromCache
|
||||
}
|
||||
private static Dictionary<string, List<RODbInfo>> _CacheByPrimaryKey = new Dictionary<string, List<RODbInfo>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<RODbInfo> remove = new List<RODbInfo>();
|
||||
foreach (RODbInfo tmp in _CacheList)
|
||||
{
|
||||
if (!_CacheByPrimaryKey.ContainsKey(tmp.RODbID.ToString()))
|
||||
{
|
||||
_CacheByPrimaryKey[tmp.RODbID.ToString()] = new List<RODbInfo>(); // Add new list for PrimaryKey
|
||||
}
|
||||
_CacheByPrimaryKey[tmp.RODbID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (RODbInfo tmp in remove)
|
||||
RemoveFromCache(tmp);
|
||||
}
|
||||
internal static void AddList(RODbInfoList lst)
|
||||
{
|
||||
foreach (RODbInfo item in lst) AddToCache(item);
|
||||
}
|
||||
protected static RODbInfo GetCachedByPrimaryKey(int rODbID)
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = rODbID.ToString();
|
||||
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
#region Business Methods
|
||||
private string _ErrorMessage = string.Empty;
|
||||
public string ErrorMessage
|
||||
{
|
||||
get { return _ErrorMessage; }
|
||||
}
|
||||
protected RODb _Editable;
|
||||
private IVEHasBrokenRules HasBrokenRules
|
||||
{
|
||||
get
|
||||
{
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
if (_Editable != null)
|
||||
hasBrokenRules = _Editable.HasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
}
|
||||
private int _RODbID;
|
||||
[System.ComponentModel.DataObjectField(true, true)]
|
||||
public int RODbID
|
||||
{
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("RODbID", true);
|
||||
return _RODbID;
|
||||
}
|
||||
}
|
||||
private string _ROName = string.Empty;
|
||||
/// <summary>
|
||||
/// Hook for future - to allow the user to select multiple RO Databases assocaiated with on DocVersion
|
||||
/// </summary>
|
||||
public string ROName
|
||||
{
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ROName", true);
|
||||
return _ROName;
|
||||
}
|
||||
}
|
||||
private string _FolderPath = string.Empty;
|
||||
/// <summary>
|
||||
/// Path to the RO database
|
||||
/// </summary>
|
||||
public string FolderPath
|
||||
{
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("FolderPath", true);
|
||||
return _FolderPath;
|
||||
}
|
||||
}
|
||||
private string _DBConnectionString = string.Empty;
|
||||
/// <summary>
|
||||
/// Connection String - Default could just be the full path and name of the database
|
||||
/// </summary>
|
||||
public string DBConnectionString
|
||||
{
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DBConnectionString", true);
|
||||
return _DBConnectionString;
|
||||
}
|
||||
}
|
||||
private string _Config = string.Empty;
|
||||
public string Config
|
||||
{
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Config", true);
|
||||
return _Config;
|
||||
}
|
||||
}
|
||||
private DateTime _DTS = new DateTime();
|
||||
public DateTime DTS
|
||||
{
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DTS", true);
|
||||
return _DTS;
|
||||
}
|
||||
}
|
||||
private string _UserID = string.Empty;
|
||||
public string UserID
|
||||
{
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("UserID", true);
|
||||
return _UserID;
|
||||
}
|
||||
}
|
||||
private int _RODbROFstCount = 0;
|
||||
/// <summary>
|
||||
/// Count of RODbROFsts for this RODb
|
||||
/// </summary>
|
||||
public int RODbROFstCount
|
||||
{
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("RODbROFstCount", true);
|
||||
return _RODbROFstCount;
|
||||
}
|
||||
}
|
||||
private ROFstInfoList _RODbROFsts = null;
|
||||
[TypeConverter(typeof(ROFstInfoListConverter))]
|
||||
public ROFstInfoList RODbROFsts
|
||||
{
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("RODbROFsts", true);
|
||||
if (_RODbROFstCount < 0 || (_RODbROFstCount > 0 && _RODbROFsts == null))
|
||||
_RODbROFsts = ROFstInfoList.GetByRODbID(_RODbID);
|
||||
if (_RODbROFstCount < 0)
|
||||
_RODbROFstCount = _RODbROFsts.Count;
|
||||
return _RODbROFsts;
|
||||
}
|
||||
}
|
||||
public void RefreshRODbROFsts()
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
if (_CacheByPrimaryKey.ContainsKey(_RODbID.ToString()))
|
||||
foreach (RODbInfo tmp in _CacheByPrimaryKey[_RODbID.ToString()])
|
||||
tmp._RODbROFstCount = -1; // This will cause the data to be requeried
|
||||
}
|
||||
private int _RODbROImageCount = 0;
|
||||
/// <summary>
|
||||
/// Count of RODbROImages for this RODb
|
||||
/// </summary>
|
||||
public int RODbROImageCount
|
||||
{
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("RODbROImageCount", true);
|
||||
return _RODbROImageCount;
|
||||
}
|
||||
}
|
||||
private ROImageInfoList _RODbROImages = null;
|
||||
[TypeConverter(typeof(ROImageInfoListConverter))]
|
||||
public ROImageInfoList RODbROImages
|
||||
{
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("RODbROImages", true);
|
||||
if (_RODbROImageCount < 0 || (_RODbROImageCount > 0 && _RODbROImages == null))
|
||||
_RODbROImages = ROImageInfoList.GetByRODbID(_RODbID);
|
||||
if (_RODbROImageCount < 0)
|
||||
_RODbROImageCount = _RODbROImages.Count;
|
||||
return _RODbROImages;
|
||||
}
|
||||
}
|
||||
public void RefreshRODbROImages()
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
if (_CacheByPrimaryKey.ContainsKey(_RODbID.ToString()))
|
||||
foreach (RODbInfo tmp in _CacheByPrimaryKey[_RODbID.ToString()])
|
||||
tmp._RODbROImageCount = -1; // This will cause the data to be requeried
|
||||
}
|
||||
private int _RODbRoUsageCount = 0;
|
||||
/// <summary>
|
||||
/// Count of RODbRoUsages for this RODb
|
||||
/// </summary>
|
||||
public int RODbRoUsageCount
|
||||
{
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("RODbRoUsageCount", true);
|
||||
return _RODbRoUsageCount;
|
||||
}
|
||||
}
|
||||
private RoUsageInfoList _RODbRoUsages = null;
|
||||
[TypeConverter(typeof(RoUsageInfoListConverter))]
|
||||
public RoUsageInfoList RODbRoUsages
|
||||
{
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("RODbRoUsages", true);
|
||||
if (_RODbRoUsageCount < 0 || (_RODbRoUsageCount > 0 && _RODbRoUsages == null))
|
||||
_RODbRoUsages = RoUsageInfoList.GetByRODbID(_RODbID);
|
||||
if (_RODbRoUsageCount < 0)
|
||||
_RODbRoUsageCount = _RODbRoUsages.Count;
|
||||
return _RODbRoUsages;
|
||||
}
|
||||
}
|
||||
public void RefreshRODbRoUsages()
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
if (_CacheByPrimaryKey.ContainsKey(_RODbID.ToString()))
|
||||
foreach (RODbInfo tmp in _CacheByPrimaryKey[_RODbID.ToString()])
|
||||
tmp._RODbRoUsageCount = -1; // This will cause the data to be requeried
|
||||
}
|
||||
// TODO: Replace base RODbInfo.ToString function as necessary
|
||||
/// <summary>
|
||||
/// Overrides Base ToString
|
||||
/// </summary>
|
||||
/// <returns>A string representation of current RODbInfo</returns>
|
||||
//public override string ToString()
|
||||
//{
|
||||
// return base.ToString();
|
||||
//}
|
||||
// TODO: Check RODbInfo.GetIdValue to assure that the ID returned is unique
|
||||
/// <summary>
|
||||
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||
/// </summary>
|
||||
/// <returns>A Unique ID for the current RODbInfo</returns>
|
||||
protected override object GetIdValue()
|
||||
{
|
||||
return _RODbID;
|
||||
}
|
||||
#endregion
|
||||
#region Factory Methods
|
||||
private static int _RODbInfoUnique = 0;
|
||||
private static int RODbInfoUnique
|
||||
{ get { return ++_RODbInfoUnique; } }
|
||||
private int _MyRODbInfoUnique = RODbInfoUnique;
|
||||
public int MyRODbInfoUnique
|
||||
{ get { return _MyRODbInfoUnique; } }
|
||||
protected RODbInfo()
|
||||
{/* require use of factory methods */
|
||||
AddToCache(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
RemoveFromCache(this);
|
||||
if (!_CacheByPrimaryKey.ContainsKey(RODbID.ToString())) return;
|
||||
List<RODbInfo> listRODbInfo = _CacheByPrimaryKey[RODbID.ToString()]; // Get the list of items
|
||||
while (listRODbInfo.Contains(this)) listRODbInfo.Remove(this); // Remove the item from the list
|
||||
if (listRODbInfo.Count == 0) // If there are no items left in the list
|
||||
_CacheByPrimaryKey.Remove(RODbID.ToString()); // remove the list
|
||||
}
|
||||
public virtual RODb Get()
|
||||
{
|
||||
return _Editable = RODb.Get(_RODbID);
|
||||
}
|
||||
public static void Refresh(RODb tmp)
|
||||
{
|
||||
string key = tmp.RODbID.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||
foreach (RODbInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
protected virtual void RefreshFields(RODb tmp)
|
||||
{
|
||||
_ROName = tmp.ROName;
|
||||
_FolderPath = tmp.FolderPath;
|
||||
_DBConnectionString = tmp.DBConnectionString;
|
||||
_Config = tmp.Config;
|
||||
_DTS = tmp.DTS;
|
||||
_UserID = tmp.UserID;
|
||||
_RODbInfoExtension.Refresh(this);
|
||||
OnChange();// raise an event
|
||||
}
|
||||
public static RODbInfo Get(int rODbID)
|
||||
{
|
||||
//if (!CanGetObject())
|
||||
// throw new System.Security.SecurityException("User not authorized to view a RODb");
|
||||
try
|
||||
{
|
||||
RODbInfo tmp = GetCachedByPrimaryKey(rODbID);
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<RODbInfo>(new PKCriteria(rODbID));
|
||||
AddToCache(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found")
|
||||
{
|
||||
tmp.Dispose(); // Clean-up RODbInfo
|
||||
tmp = null;
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new DbCslaException("Error on RODbInfo.Get", ex);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Data Access Portal
|
||||
internal RODbInfo(SafeDataReader dr)
|
||||
{
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RODbInfo.Constructor", GetHashCode());
|
||||
try
|
||||
{
|
||||
ReadData(dr);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("RODbInfo.Constructor", ex);
|
||||
throw new DbCslaException("RODbInfo.Constructor", ex);
|
||||
}
|
||||
}
|
||||
[Serializable()]
|
||||
protected class PKCriteria
|
||||
{
|
||||
private int _RODbID;
|
||||
public int RODbID
|
||||
{ get { return _RODbID; } }
|
||||
public PKCriteria(int rODbID)
|
||||
{
|
||||
_RODbID = rODbID;
|
||||
}
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RODbInfo.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_RODbID = dr.GetInt32("RODbID");
|
||||
_ROName = dr.GetString("ROName");
|
||||
_FolderPath = dr.GetString("FolderPath");
|
||||
_DBConnectionString = dr.GetString("DBConnectionString");
|
||||
_Config = dr.GetString("Config");
|
||||
_DTS = dr.GetDateTime("DTS");
|
||||
_UserID = dr.GetString("UserID");
|
||||
_RODbROFstCount = dr.GetInt32("ROFstCount");
|
||||
_RODbROImageCount = dr.GetInt32("ROImageCount");
|
||||
_RODbRoUsageCount = dr.GetInt32("RoUsageCount");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("RODbInfo.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("RODbInfo.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RODbInfo.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
{
|
||||
ApplicationContext.LocalContext["cn"] = cn;
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
{
|
||||
cm.CommandType = CommandType.StoredProcedure;
|
||||
cm.CommandText = "getRODb";
|
||||
cm.Parameters.AddWithValue("@RODbID", criteria.RODbID);
|
||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||
{
|
||||
if (!dr.Read())
|
||||
{
|
||||
_ErrorMessage = "No Record Found";
|
||||
return;
|
||||
}
|
||||
ReadData(dr);
|
||||
}
|
||||
}
|
||||
// removing of item only needed for local data portal
|
||||
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
||||
ApplicationContext.LocalContext.Remove("cn");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("RODbInfo.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("RODbInfo.DataPortal_Fetch", ex);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
// Standard Refresh
|
||||
#region extension
|
||||
RODbInfoExtension _RODbInfoExtension = new RODbInfoExtension();
|
||||
[Serializable()]
|
||||
partial class RODbInfoExtension : extensionBase { }
|
||||
[Serializable()]
|
||||
class extensionBase
|
||||
{
|
||||
// Default Refresh
|
||||
public virtual void Refresh(RODbInfo tmp) { }
|
||||
}
|
||||
#endregion
|
||||
} // Class
|
||||
#region Converter
|
||||
internal class RODbInfoConverter : ExpandableObjectConverter
|
||||
{
|
||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||
{
|
||||
if (destType == typeof(string) && value is RODbInfo)
|
||||
{
|
||||
// Return the ToString value
|
||||
return ((RODbInfo)value).ToString();
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
} // Namespace
|
205
PROMS/VEPROMS.CSLA.Library/Generated/RODbInfoList.cs
Normal file
205
PROMS/VEPROMS.CSLA.Library/Generated/RODbInfoList.cs
Normal file
@ -0,0 +1,205 @@
|
||||
// ========================================================================
|
||||
// Copyright 2007 - Volian Enterprises, Inc. All rights reserved.
|
||||
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||
// ------------------------------------------------------------------------
|
||||
// $Workfile: $ $Revision: $
|
||||
// $Author: $ $Date: $
|
||||
//
|
||||
// $History: $
|
||||
// ========================================================================
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using Csla;
|
||||
using Csla.Data;
|
||||
using System.Configuration;
|
||||
using System.IO;
|
||||
using System.ComponentModel;
|
||||
using System.Collections.Generic;
|
||||
namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
/// <summary>
|
||||
/// RODbInfoList Generated by MyGeneration using the CSLA Object Mapping template
|
||||
/// </summary>
|
||||
[Serializable()]
|
||||
[TypeConverter(typeof(RODbInfoListConverter))]
|
||||
public partial class RODbInfoList : ReadOnlyListBase<RODbInfoList, RODbInfo>, ICustomTypeDescriptor, IDisposable
|
||||
{
|
||||
#region Log4Net
|
||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
#endregion
|
||||
#region Business Methods
|
||||
internal new IList<RODbInfo> Items
|
||||
{ get { return base.Items; } }
|
||||
public void AddEvents()
|
||||
{
|
||||
foreach (RODbInfo tmp in this)
|
||||
{
|
||||
tmp.Changed += new RODbInfoEvent(tmp_Changed);
|
||||
}
|
||||
}
|
||||
void tmp_Changed(object sender)
|
||||
{
|
||||
for (int i = 0; i < Count; i++)
|
||||
{
|
||||
if (base[i] == sender)
|
||||
this.OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, i));
|
||||
}
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
foreach (RODbInfo tmp in this)
|
||||
{
|
||||
tmp.Changed -= new RODbInfoEvent(tmp_Changed);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Factory Methods
|
||||
public static RODbInfoList _RODbInfoList = null;
|
||||
/// <summary>
|
||||
/// Return a list of all RODbInfo.
|
||||
/// </summary>
|
||||
public static RODbInfoList Get()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_RODbInfoList != null)
|
||||
return _RODbInfoList;
|
||||
RODbInfoList tmp = DataPortal.Fetch<RODbInfoList>();
|
||||
RODbInfo.AddList(tmp);
|
||||
tmp.AddEvents();
|
||||
_RODbInfoList = tmp;
|
||||
return tmp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new DbCslaException("Error on RODbInfoList.Get", ex);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Reset the list of all RODbInfo.
|
||||
/// </summary>
|
||||
public static void Reset()
|
||||
{
|
||||
_RODbInfoList = null;
|
||||
}
|
||||
// TODO: Add alternative gets -
|
||||
//public static RODbInfoList Get(<criteria>)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// return DataPortal.Fetch<RODbInfoList>(new FilteredCriteria(<criteria>));
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// throw new DbCslaException("Error on RODbInfoList.Get", ex);
|
||||
// }
|
||||
//}
|
||||
private RODbInfoList()
|
||||
{ /* require use of factory methods */ }
|
||||
#endregion
|
||||
#region Data Access Portal
|
||||
private void DataPortal_Fetch()
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RODbInfoList.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
{
|
||||
cm.CommandType = CommandType.StoredProcedure;
|
||||
cm.CommandText = "getRODbs";
|
||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||
{
|
||||
IsReadOnly = false;
|
||||
while (dr.Read()) this.Add(new RODbInfo(dr));
|
||||
IsReadOnly = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("RODbInfoList.DataPortal_Fetch", ex);
|
||||
throw new DbCslaException("RODbInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
}
|
||||
#endregion
|
||||
#region ICustomTypeDescriptor impl
|
||||
public String GetClassName()
|
||||
{ return TypeDescriptor.GetClassName(this, true); }
|
||||
public AttributeCollection GetAttributes()
|
||||
{ return TypeDescriptor.GetAttributes(this, true); }
|
||||
public String GetComponentName()
|
||||
{ return TypeDescriptor.GetComponentName(this, true); }
|
||||
public TypeConverter GetConverter()
|
||||
{ return TypeDescriptor.GetConverter(this, true); }
|
||||
public EventDescriptor GetDefaultEvent()
|
||||
{ return TypeDescriptor.GetDefaultEvent(this, true); }
|
||||
public PropertyDescriptor GetDefaultProperty()
|
||||
{ return TypeDescriptor.GetDefaultProperty(this, true); }
|
||||
public object GetEditor(Type editorBaseType)
|
||||
{ return TypeDescriptor.GetEditor(this, editorBaseType, true); }
|
||||
public EventDescriptorCollection GetEvents(Attribute[] attributes)
|
||||
{ return TypeDescriptor.GetEvents(this, attributes, true); }
|
||||
public EventDescriptorCollection GetEvents()
|
||||
{ return TypeDescriptor.GetEvents(this, true); }
|
||||
public object GetPropertyOwner(PropertyDescriptor pd)
|
||||
{ return this; }
|
||||
/// <summary>
|
||||
/// Called to get the properties of this type. Returns properties with certain
|
||||
/// attributes. this restriction is not implemented here.
|
||||
/// </summary>
|
||||
/// <param name="attributes"></param>
|
||||
/// <returns></returns>
|
||||
public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
|
||||
{ return GetProperties(); }
|
||||
/// <summary>
|
||||
/// Called to get the properties of this type.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public PropertyDescriptorCollection GetProperties()
|
||||
{
|
||||
// Create a collection object to hold property descriptors
|
||||
PropertyDescriptorCollection pds = new PropertyDescriptorCollection(null);
|
||||
// Iterate the list
|
||||
for (int i = 0; i < this.Items.Count; i++)
|
||||
{
|
||||
// Create a property descriptor for the item and add to the property descriptor collection
|
||||
RODbInfoListPropertyDescriptor pd = new RODbInfoListPropertyDescriptor(this, i);
|
||||
pds.Add(pd);
|
||||
}
|
||||
// return the property descriptor collection
|
||||
return pds;
|
||||
}
|
||||
#endregion
|
||||
} // Class
|
||||
#region Property Descriptor
|
||||
/// <summary>
|
||||
/// Summary description for CollectionPropertyDescriptor.
|
||||
/// </summary>
|
||||
public partial class RODbInfoListPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private RODbInfo Item { get { return (RODbInfo)_Item; } }
|
||||
public RODbInfoListPropertyDescriptor(RODbInfoList collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
internal class RODbInfoListConverter : ExpandableObjectConverter
|
||||
{
|
||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||
{
|
||||
if (destType == typeof(string) && value is RODbInfoList)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((RODbInfoList)value).Items.Count.ToString() + " RODbs";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
} // Namespace
|
Loading…
x
Reference in New Issue
Block a user