
Add RoFstLookup Dicitonary Entries for Multiple Return Values AddByROFstIDImageIDs - Add a list of figures based upon a List of ImageIDs Fix regular expression to find RO Text to replace GetDROUsagesByROIDs - get a list of ROUSages for a list of ROIDs GetJustRODB - Get Just RODB object without children GetJustROFst - Get Just ROFst or ROFstInfo object without children Reduce duplicate gets of RODB and ROFst Improve ROFst Update Performance GetByRODbIDNoData - Get RoImageInfo objects without graphic data for ROFst Update comparison GetROUSagesByROIDs - Get a list of ROUSages by ROIDs. This reduces the number of ROIDs to be checked when updating ROFst. Use GetJustRoFst and GetJustRoDB to improve the performance to see if the "Update ROFst" button should be active.
169 lines
4.3 KiB
C#
169 lines
4.3 KiB
C#
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 RoUsageInfoList
|
|
{
|
|
[Serializable()]
|
|
private class AffectedROUsagesCriteria
|
|
{
|
|
public AffectedROUsagesCriteria(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 RoUsageInfoList GetAffected(int roDbID, string roid, string roDesc, string command)
|
|
{
|
|
try
|
|
{
|
|
RoUsageInfoList tmp = DataPortal.Fetch<RoUsageInfoList>(new AffectedROUsagesCriteria(roDbID, roid, roDesc, command, Volian.Base.Library.VlnSettings.UserID));
|
|
RoUsageInfo.AddList(tmp);
|
|
tmp.AddEvents();
|
|
return tmp;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new DbCslaException("Error on ROUsageInfoList.GetAffected", ex);
|
|
}
|
|
}
|
|
private void DataPortal_Fetch(AffectedROUsagesCriteria criteria)
|
|
{
|
|
this.RaiseListChangedEvents = false;
|
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROUsageInfoList.DataPortal_FetchAffected", GetHashCode());
|
|
try
|
|
{
|
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
|
{
|
|
using (SqlCommand cm = cn.CreateCommand())
|
|
{
|
|
cm.CommandType = CommandType.StoredProcedure;
|
|
cm.CommandText = "getAffectedRoUsages";
|
|
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 RoUsageInfo(dr));
|
|
IsReadOnly = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("TransitionInfoList.DataPortal_FetchAffected", ex);
|
|
throw new DbCslaException("ROUsageInfoList.DataPortal_Fetch", ex);
|
|
}
|
|
this.RaiseListChangedEvents = true;
|
|
}
|
|
[Serializable]
|
|
private class GetROUsagesByROIDsCriteria
|
|
{
|
|
public GetROUsagesByROIDsCriteria(string roids)
|
|
{
|
|
_ROIDS = roids;
|
|
}
|
|
private string _ROIDS;
|
|
public string ROIDS
|
|
{
|
|
get { return _ROIDS; }
|
|
set { _ROIDS = value; }
|
|
}
|
|
}
|
|
public static RoUsageInfoList GetROUSagesByROIDs(string roids)
|
|
{
|
|
try
|
|
{
|
|
RoUsageInfoList tmp = DataPortal.Fetch<RoUsageInfoList>(new GetROUsagesByROIDsCriteria(roids));
|
|
RoUsageInfo.AddList(tmp);
|
|
tmp.AddEvents();
|
|
return tmp;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new DbCslaException("Error on ROUsageInfoList.FindROUSagesByROIDs", ex);
|
|
}
|
|
}
|
|
private void DataPortal_Fetch(GetROUsagesByROIDsCriteria criteria)
|
|
{
|
|
this.RaiseListChangedEvents = false;
|
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROUsageInfoList.DataPortal_FetchFindByRoids", GetHashCode());
|
|
try
|
|
{
|
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
|
{
|
|
using (SqlCommand cm = cn.CreateCommand())
|
|
{
|
|
cm.CommandType = CommandType.StoredProcedure;
|
|
cm.CommandText = "getRoUsagesByRoids";
|
|
cm.Parameters.AddWithValue("@ROIDS", criteria.ROIDS);
|
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
|
{
|
|
IsReadOnly = false;
|
|
while (dr.Read())
|
|
this.Add(new RoUsageInfo(dr));
|
|
IsReadOnly = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("ROUsageInfoList.DataPortal_FetchFindByRoids", ex);
|
|
throw new DbCslaException("ROUsageInfoList.DataPortal_Fetch", ex);
|
|
}
|
|
this.RaiseListChangedEvents = true;
|
|
}
|
|
}
|
|
}
|