CSLA - Extension

This commit is contained in:
2026-09-01 08:21:41 -04:00
parent dcd2fbc294
commit dab65dbfb6
30 changed files with 2703 additions and 5680 deletions
+46 -173
View File
@@ -13,10 +13,7 @@ using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
using System.Configuration;
using System.IO;
using System.Drawing;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text.RegularExpressions;
using System.Linq;
@@ -40,73 +37,19 @@ namespace VEPROMS.CSLA.Library
return _FolderConfig;
}
}
public void FolderConfigRefresh()
{
_FolderConfig = null;
}
private void _FolderConfig_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
Config = _FolderConfig.ToString();
}
#endregion
public override string ToString()
{
return _Title;
}
#region IVEReadOnlyItem
//public System.Collections.IList GetChildren()
//{
// if (FolderDocVersionCount != 0) return FolderDocVersions;
// if (ChildFolderCount != 0) return ChildFolders;
// return null;
//}
//public bool HasChildren
//{
// get { return _FolderDocVersionCount > 0 || _ChildFolderCount > 0; }
//}
//public IVEDrillDown ActiveParent
//{
// get
// {
// return MyParent;
// }
//}
//private Format _ActiveFormat = null;
//public Format ActiveFormat
//{
// get
// {
// if (_ActiveFormat == null)
// _ActiveFormat = (LocalFormat != null ? LocalFormat : ActiveParent != null ? ActiveParent.ActiveFormat : null);
// return _ActiveFormat;
// }
// set
// {
// _ActiveFormat = null; // Reset
// }
//}
//public Format LocalFormat
//{
// get { return MyFormat; }
//}
public ConfigDynamicTypeDescriptor MyConfig
{
get { return FolderConfig; }
}
#endregion
#region MakeFolders for ManualOrder
public static Folder MakeFolder(Folder myParent, Connection myConnection, string name, string title, string shortName, Format myFormat, string config, DateTime dts, string usrID)
{
return MakeFolder(myParent, myConnection, name, title, shortName, myFormat, null, config, dts, usrID);
}
public static Folder MakeFolder(Folder myParent, Connection myConnection, string name, string title, string shortName, Format myFormat, string config)
{
return MakeFolder(myParent, myConnection, name, title, shortName, myFormat, null, config);
}
#endregion
public FolderInfo MyFolderInfo
{ get { return FolderInfo.Get(FolderID); } }
}
public void FolderConfigRefresh() => _FolderConfig = null;
private void _FolderConfig_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) => Config = _FolderConfig.ToString();
#endregion
public override string ToString() => _Title;
#region IVEReadOnlyItem
public ConfigDynamicTypeDescriptor MyConfig => FolderConfig;
#endregion
#region MakeFolders for ManualOrder
public static Folder MakeFolder(Folder myParent, Connection myConnection, string name, string title, string shortName, Format myFormat, string config, DateTime dts, string usrID) => MakeFolder(myParent, myConnection, name, title, shortName, myFormat, null, config, dts, usrID);
public static Folder MakeFolder(Folder myParent, Connection myConnection, string name, string title, string shortName, Format myFormat, string config) => MakeFolder(myParent, myConnection, name, title, shortName, myFormat, null, config);
#endregion
public FolderInfo MyFolderInfo => FolderInfo.Get(FolderID);
}
public partial class FolderInfo:IVEDrillDownReadOnly
{
#region Search Paths
@@ -125,26 +68,20 @@ namespace VEPROMS.CSLA.Library
return _SearchDVPath;
}
}
public string SearchPath { get { return ""; } }
public string SearchPath => "";
// B2021-076: Proms search results are not presented in order when printed to PDF
public string SearchDefaultSort { get { return string.Empty; } }
#endregion
#region Folder Config (Read-Only)
[NonSerialized]
// B2021-076: Proms search results are not presented in order when printed to PDF
public string SearchDefaultSort => string.Empty;
#endregion
#region Folder Config (Read-Only)
[NonSerialized]
private FolderConfig _FolderConfig;
public FolderConfig FolderConfig
{ get {
return (_FolderConfig != null ? _FolderConfig : _FolderConfig = new FolderConfig(this));
} }
private void FolderConfigRefresh()
{
_FolderConfig = null;
}
#endregion
#region SortingChildren
private static bool IsInManualOrderNullFix = false;
public FolderConfig FolderConfig => _FolderConfig ?? (_FolderConfig = new FolderConfig(this));
private void FolderConfigRefresh() => _FolderConfig = null;
#endregion
#region SortingChildren
private static bool IsInManualOrderNullFix = false;
[NonSerialized]
public Csla.SortedBindingList<FolderInfo> _SortedChildFolders;
@@ -180,8 +117,6 @@ namespace VEPROMS.CSLA.Library
if (_SortedChildFolders == null)
{
_SortedChildFolders = new SortedBindingList<FolderInfo>(ChildFolders);
//_SortedChildFolders.ApplySort("FolderID", ListSortDirection.Ascending);
//_SortedChildFolders.ApplySort("Name", ListSortDirection.Ascending);
}
else if (_SortedChildFolders.Count != ChildFolders.Count)
{
@@ -266,43 +201,20 @@ namespace VEPROMS.CSLA.Library
public System.Collections.IList GetChildren()
{
if(FolderDocVersionCount != 0)return FolderDocVersions;
//if (ChildFolderCount != 0) return ChildFolders;
if (ChildFolderCount != 0) return SortedChildFolders;
return null;
}
//public bool ChildrenAreLoaded
//{
// get { return _FolderDocVersions != null || _ChildFolders != null; }
//}
public bool HasChildren
{
get { return FolderDocVersionCount > 0 || ChildFolderCount > 0; }
}
public IVEDrillDownReadOnly ActiveParent
{
get
{
return MyParent;
}
}
public FormatInfo ActiveFormat
{
get { return LocalFormat != null ? LocalFormat : ( ActiveParent != null ? ActiveParent.ActiveFormat : null); }
}
public FormatInfo LocalFormat
{
get { return MyFormat; }
}
public ConfigDynamicTypeDescriptor MyConfig
{
get { return FolderConfig; }
}
/// <summary>
/// These settings are set on the user interface side.
/// This is used to control whether the Name and/or Title is displayed
/// next to the tree nodes in the user interface
/// </summary>
private bool _DisplayTreeNodeNames = true;
public bool HasChildren => FolderDocVersionCount > 0 || ChildFolderCount > 0;
public IVEDrillDownReadOnly ActiveParent => MyParent;
public FormatInfo ActiveFormat => LocalFormat ?? (ActiveParent?.ActiveFormat);
public FormatInfo LocalFormat => MyFormat;
public ConfigDynamicTypeDescriptor MyConfig => FolderConfig;
/// <summary>
/// These settings are set on the user interface side.
/// This is used to control whether the Name and/or Title is displayed
/// next to the tree nodes in the user interface
/// </summary>
private bool _DisplayTreeNodeNames = true;
public bool DisplayTreeNodeNames
{
get { return _DisplayTreeNodeNames; }
@@ -326,12 +238,7 @@ namespace VEPROMS.CSLA.Library
rtnstr += Title;
}
return rtnstr;
//return string.Format("{0} - {1}", Name, Title);
}
//public string ToString(string str, System.IFormatProvider ifp)
//{
// return ToString();
//}
#endregion
public Color BackColor
{ get { return FolderConfig.Default_BkColor; } }
@@ -351,15 +258,10 @@ namespace VEPROMS.CSLA.Library
#region Extension
partial class FolderInfoExtension : extensionBase
{
public override void Refresh(FolderInfo tmp)
{
tmp.FolderConfigRefresh();
}
}
public override void Refresh(FolderInfo tmp) => tmp.FolderConfigRefresh();
}
public static FolderInfo GetTop()
{
//if (!CanGetObject())
// throw new System.Security.SecurityException("User not authorized to view a Folder");
try
{
FolderInfo tmp = DataPortal.Fetch<FolderInfo>(new TopCriteria());
@@ -375,7 +277,8 @@ namespace VEPROMS.CSLA.Library
throw new DbCslaException("Error on FolderInfo.GetTop", ex);
}
}
private void DataPortal_Fetch(TopCriteria criteria)
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Keeping until replace CSLA")]
private void DataPortal_Fetch(TopCriteria criteria)
{
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FolderInfo.DataPortal_Fetch", GetHashCode());
try
@@ -416,41 +319,11 @@ namespace VEPROMS.CSLA.Library
{
public TopCriteria() { ;}
}
public bool IsFolder
{
get
{
return true;
}
}
public bool IsDocVersion
{
get
{
return false;
}
}
public bool IsProcedure
{
get
{
return false;
}
}
public bool IsSection
{
get
{
return false;
}
}
public bool IsStep
{
get
{
return false;
}
}
}
public bool IsFolder => true;
public bool IsDocVersion => false;
public bool IsProcedure => false;
public bool IsSection => false;
public bool IsStep => false;
}
}