Added DROUsages table to capture ROUsages in Documents
This commit is contained in:
parent
5994bf2e4e
commit
7cdc7f4994
110
PROMS/VEPROMS.CSLA.Library/Extension/DROUsagesExt.cs
Normal file
110
PROMS/VEPROMS.CSLA.Library/Extension/DROUsagesExt.cs
Normal file
@ -0,0 +1,110 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using Csla;
|
||||
using Csla.Data;
|
||||
|
||||
namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
public partial class DROUsageInfoList
|
||||
{
|
||||
[Serializable()]
|
||||
private class AffectedDROUsagesCriteria
|
||||
{
|
||||
public AffectedDROUsagesCriteria(int roDbID, string roid, string roDesc, string command, string userID)
|
||||
{
|
||||
_RODbID = roDbID;
|
||||
_ROID = roid;
|
||||
_RODesc = roDesc;
|
||||
_Command = command;
|
||||
_UserID = userID;
|
||||
}
|
||||
private int _RODbID;
|
||||
|
||||
public int RODbID
|
||||
{
|
||||
get { return _RODbID; }
|
||||
set { _RODbID = value; }
|
||||
}
|
||||
private string _ROID;
|
||||
|
||||
public string ROID
|
||||
{
|
||||
get { return _ROID; }
|
||||
set { _ROID = value; }
|
||||
}
|
||||
private string _RODesc;
|
||||
|
||||
public string RODesc
|
||||
{
|
||||
get { return _RODesc; }
|
||||
set { _RODesc = value; }
|
||||
}
|
||||
private string _Command;
|
||||
|
||||
public string Command
|
||||
{
|
||||
get { return _Command; }
|
||||
set { _Command = value; }
|
||||
}
|
||||
private string _UserID;
|
||||
|
||||
public string UserID
|
||||
{
|
||||
get { return _UserID; }
|
||||
set { _UserID = value; }
|
||||
}
|
||||
}
|
||||
public static DROUsageInfoList GetAffected(int roDbID, string roid, string roDesc, string command)
|
||||
{
|
||||
try
|
||||
{
|
||||
DROUsageInfoList tmp = DataPortal.Fetch<DROUsageInfoList>(new AffectedDROUsagesCriteria(roDbID, roid, roDesc, command, Volian.Base.Library.VlnSettings.UserID));
|
||||
DROUsageInfo.AddList(tmp);
|
||||
tmp.AddEvents();
|
||||
return tmp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new DbCslaException("Error on DROUsageInfoList.GetAffected", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(AffectedDROUsagesCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DROUsageInfoList.DataPortal_FetchAffected", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
{
|
||||
cm.CommandType = CommandType.StoredProcedure;
|
||||
cm.CommandText = "getAffectedDRoUsages";
|
||||
cm.Parameters.AddWithValue("@RODbID", criteria.RODbID);
|
||||
cm.Parameters.AddWithValue("@ROID", criteria.ROID);
|
||||
cm.Parameters.AddWithValue("@RODesc", criteria.RODesc);
|
||||
cm.Parameters.AddWithValue("@Command", criteria.Command);
|
||||
cm.Parameters.AddWithValue("@UserID", criteria.UserID);
|
||||
|
||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||
{
|
||||
IsReadOnly = false;
|
||||
while (dr.Read())
|
||||
this.Add(new DROUsageInfo(dr));
|
||||
IsReadOnly = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DROUsageInfoList.DataPortal_FetchAffected", ex);
|
||||
throw new DbCslaException("DROUsageInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user