B2022-026 RO Memory reduction coding

This commit is contained in:
2022-05-26 19:55:07 +00:00
parent 61febac1a0
commit 27993553cb
21 changed files with 6827 additions and 5160 deletions

View File

@@ -16,6 +16,7 @@ namespace VEPROMS.CSLA.Library
Procedure = 0, Document = 1, DocVersion = 2, Folder = 3, Session = 4
}
#endregion
#region SessionInfoList stuff
public partial class SessionInfoList
{
@@ -67,6 +68,7 @@ namespace VEPROMS.CSLA.Library
}
}
#endregion
#region SessionInfo stuff
public partial class SessionInfo
{
@@ -750,6 +752,7 @@ namespace VEPROMS.CSLA.Library
#endregion
}
#endregion
#region OwnerInfo stuff
public partial class OwnerInfoList
{
@@ -1072,29 +1075,36 @@ namespace VEPROMS.CSLA.Library
}
}
#endregion
#region UserInfo stuff
public partial class UserInfo
{
public static bool CanEdit(UserInfo myUserInfo, DocVersionInfo myDVI)
{
return myUserInfo!=null && myDVI!=null && (myUserInfo.IsAdministrator() || myUserInfo.IsSetAdministrator(myDVI) || myUserInfo.IsWriter(myDVI));
}
public static bool CanEditROs(UserInfo myUserInfo, DocVersionInfo myDVI)
{
return myUserInfo != null && myDVI != null && myUserInfo.IsAdministrator() || myUserInfo.IsSetAdministrator(myDVI) || myUserInfo.IsROEditor(myDVI);
}
public static bool CanCreateFolders(UserInfo myUserInfo, DocVersionInfo myDVI)
{
return myUserInfo != null && myDVI != null && myUserInfo.IsAdministrator() || myUserInfo.IsSetAdministrator(myDVI);
}
public static bool CanCreateFolders(UserInfo myUserInfo, FolderInfo fi)
{
return myUserInfo != null && fi != null && myUserInfo.IsAdministrator() || myUserInfo.IsSetAdministrator(fi.MyParent); //B2020-111 allow if set amin controls parent
}
public bool IsAdministrator()
{
if (this.UserMembershipCount == 0)
return false;
foreach (MembershipInfo mi in this.UserMemberships)
{
if (mi.EndDate == string.Empty)
@@ -1108,6 +1118,7 @@ namespace VEPROMS.CSLA.Library
}
return false;
}
//B2020-111, B2020-114, C2020-035 this was setting the passed in parameter, such that the first time this
// was called, the passed in parameter was set to the top node (VEPROMS). The check of other folders
// would then be skipped (from where is called)
@@ -1115,6 +1126,7 @@ namespace VEPROMS.CSLA.Library
{
if (this.UserMembershipCount == 0 || fldinf == null)
return false;
foreach (MembershipInfo mi in this.UserMemberships)
{
if (mi.EndDate == string.Empty)
@@ -1137,10 +1149,12 @@ namespace VEPROMS.CSLA.Library
}
return false;
}
public bool IsSetAdministrator(DocVersionInfo dv)
{
if (this.UserMembershipCount == 0)
if (this.UserMembershipCount == 0 || dv == null) // B2022-026 RO Memory reduction - check for null DocVersionInfo
return false;
foreach (MembershipInfo mi in this.UserMemberships)
{
if (mi.EndDate == string.Empty)
@@ -1162,10 +1176,12 @@ namespace VEPROMS.CSLA.Library
}
return false;
}
public bool IsWriter(DocVersionInfo dv)
{
if (this.UserMembershipCount == 0)
if (this.UserMembershipCount == 0 || dv == null) // B2022-026 RO Memory reduction - check for null DocVersionInfo
return false;
foreach (MembershipInfo mi in this.UserMemberships)
{
if (mi.EndDate == string.Empty)
@@ -1187,10 +1203,12 @@ namespace VEPROMS.CSLA.Library
}
return false;
}
public bool IsReviewer(DocVersionInfo dv)
{
if (this.UserMembershipCount == 0)
if (this.UserMembershipCount == 0 || dv == null) // B2022-026 RO Memory reduction - check for null DocVersionInfo
return false;
foreach (MembershipInfo mi in this.UserMemberships)
{
if (mi.EndDate == string.Empty)
@@ -1212,10 +1230,12 @@ namespace VEPROMS.CSLA.Library
}
return false;
}
public bool IsROEditor(DocVersionInfo dv)
{
if (this.UserMembershipCount == 0)
if (this.UserMembershipCount == 0 || dv == null) // B2022-026 RO Memory reduction - check for null DocVersionInfo
return false;
foreach (MembershipInfo mi in this.UserMemberships)
{
if (mi.EndDate == string.Empty)
@@ -1237,6 +1257,7 @@ namespace VEPROMS.CSLA.Library
}
return false;
}
// B2018-112 added for easy check if user's PROMS Security allows making edits - used in StepTabRibbon - SetButtonAndMenuEnabling()
public bool IsAllowedToEdit(DocVersionInfo dvi)
{
@@ -1259,6 +1280,7 @@ namespace VEPROMS.CSLA.Library
throw new DbCslaException("Error on UserInfo.GetByUserID", ex);
}
}
[Serializable()]
protected class GetByUserIDCriteria
{
@@ -1270,6 +1292,7 @@ namespace VEPROMS.CSLA.Library
_UserID = userID;
}
}
private void DataPortal_Fetch(GetByUserIDCriteria criteria)
{
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] UserInfo.DataPortal_Fetch", GetHashCode());
@@ -1307,5 +1330,6 @@ namespace VEPROMS.CSLA.Library
}
}
}
#endregion
}