This commit is contained in:
@@ -2,6 +2,10 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using Csla;
|
||||
using Csla.Data;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
@@ -45,6 +49,69 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
public partial class DocumentInfoList
|
||||
{
|
||||
public static DocumentInfoList GetLibraries()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_DocumentInfoList != null)
|
||||
return _DocumentInfoList;
|
||||
DocumentInfoList tmp = DataPortal.Fetch<DocumentInfoList>(new LibraryCriteria(true));
|
||||
DocumentInfo.AddList(tmp);
|
||||
tmp.AddEvents();
|
||||
_DocumentInfoList = tmp;
|
||||
return tmp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new DbCslaException("Error on DocumentInfoList.Get", ex);
|
||||
}
|
||||
}
|
||||
[Serializable()]
|
||||
protected class LibraryCriteria
|
||||
{
|
||||
private bool _IsLibrary;
|
||||
|
||||
public bool IsLibrary
|
||||
{
|
||||
get { return _IsLibrary; }
|
||||
set { _IsLibrary = value; }
|
||||
}
|
||||
public LibraryCriteria(bool islibrary)
|
||||
{
|
||||
_IsLibrary = islibrary;
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(LibraryCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocumentInfoList.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
{
|
||||
cm.CommandType = CommandType.StoredProcedure;
|
||||
cm.CommandText = "getLibraryDocuments";
|
||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||
{
|
||||
IsReadOnly = false;
|
||||
while (dr.Read()) this.Add(new DocumentInfo(dr));
|
||||
IsReadOnly = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocumentInfoList.DataPortal_Fetch", ex);
|
||||
throw new DbCslaException("DocumentInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
}
|
||||
}
|
||||
public class DSOFile : IDisposable
|
||||
{
|
||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
Reference in New Issue
Block a user