Improve ROFst Update Performance

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.
This commit is contained in:
Rich
2011-07-18 14:57:47 +00:00
parent 248c1679bc
commit be814b9743
9 changed files with 652 additions and 85 deletions

View File

@@ -35,6 +35,77 @@ namespace VEPROMS.CSLA.Library
_RODbConfig = null;
}
#endregion
public static RODbInfo GetJustRODB(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 PKCriteriaJustRODB(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);
}
}
[Serializable()]
protected class PKCriteriaJustRODB
{
private int _RODbID;
public int RODbID
{ get { return _RODbID; } }
public PKCriteriaJustRODB(int rODbID)
{
_RODbID = rODbID;
}
}
private void DataPortal_Fetch(PKCriteriaJustRODB 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 = "getJustRODb";
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);
}
}
}
public partial class RODb
{