mschill 378653c536 C2025-011 PROMS – RO Update Admin Tool Memory Enhancements
The purpose of this upgrade is to improve the user experience when using the Admin tool to Update ROs. Currently for larger RO dbs (like Barakah) we can run up against memory constraints that do not allow all the ROs to be updated at one time. This is based upon some initial resource where some places were identified where we could improve memory usage.  Some of these should benefit PROMS as a whole while others will be specific to the RO Update option in Admin Tools.
2025-02-04 13:23:21 -05:00

433 lines
15 KiB
C#

// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// ConnectionFolder Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class ConnectionFolder : BusinessBase<ConnectionFolder>
{
#region Business Methods
private int _folderid;
[System.ComponentModel.DataObjectField(true, true)]
public int Folderid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
return _folderid;
}
}
private int _parentid;
[System.ComponentModel.DataObjectField(true, true)]
public int Parentid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
return _parentid;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
if (_parentid != value)
{
_parentid = value;
PropertyHasChanged();
}
}
}
private string _name = string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Name
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
return _name;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
if (value == null) value = string.Empty;
if (_name != value)
{
_name = value;
PropertyHasChanged();
}
}
}
private string _title = string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Title
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
return _title;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
if (value == null) value = string.Empty;
if (_title != value)
{
_title = value;
PropertyHasChanged();
}
}
}
private string _config = string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Config
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
return _config;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
if (value == null) value = string.Empty;
if (_config != value)
{
_config = value;
PropertyHasChanged();
}
}
}
private DateTime _dts = new DateTime();
[System.ComponentModel.DataObjectField(true, true)]
public DateTime Dts
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
return _dts;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
if (_dts != value)
{
_dts = value;
PropertyHasChanged();
}
}
}
private string _usrid = string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Usrid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
return _usrid;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
if (value == null) value = string.Empty;
if (_usrid != value)
{
_usrid = value;
PropertyHasChanged();
}
}
}
private byte[] _lastchanged = new byte[8];//timestamp
// TODO: Check ConnectionFolder.GetIdValue to assure that the ID returned is unique
/// <summary>
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
/// </summary>
/// <returns>A Unique ID for the current ConnectionFolder</returns>
protected override object GetIdValue()
{
return _folderid;
}
// TODO: Replace base ConnectionFolder.ToString function as necessary
/// <summary>
/// Overrides Base ToString
/// </summary>
/// <returns>A string representation of current ConnectionFolder</returns>
//public override string ToString()
//{
// return base.ToString();
//}
#endregion
#region ValidationRules
protected override void AddBusinessRules()
{
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringRequired, "Name");
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 100));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Title", 510));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Config", 1073741823));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Usrid", 100));
// TODO: Add other validation rules
}
// Sample data comparison validation rule
//private bool StartDateGTEndDate(object target, Csla.Validation.RuleArgs e)
//{
// if (_started > _ended)
// {
// e.Description = "Start date can't be after end date";
// return false;
// }
// else
// return true;
//}
#endregion
#region Authorization Rules
protected override void AddAuthorizationRules()
{
//TODO: Who can read/write which fields
//AuthorizationRules.AllowRead(Folderid, "<Role(s)>");
//AuthorizationRules.AllowRead(Parentid, "<Role(s)>");
//AuthorizationRules.AllowWrite(Parentid, "<Role(s)>");
//AuthorizationRules.AllowRead(Name, "<Role(s)>");
//AuthorizationRules.AllowWrite(Name, "<Role(s)>");
//AuthorizationRules.AllowRead(Title, "<Role(s)>");
//AuthorizationRules.AllowWrite(Title, "<Role(s)>");
//AuthorizationRules.AllowRead(Config, "<Role(s)>");
//AuthorizationRules.AllowWrite(Config, "<Role(s)>");
//AuthorizationRules.AllowRead(Dts, "<Role(s)>");
//AuthorizationRules.AllowWrite(Dts, "<Role(s)>");
//AuthorizationRules.AllowRead(Usrid, "<Role(s)>");
//AuthorizationRules.AllowWrite(Usrid, "<Role(s)>");
}
public static bool CanAddObject()
{
// TODO: Can Add Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
public static bool CanGetObject()
{
// TODO: CanGet Authorization
return true;
}
public static bool CanDeleteObject()
{
// TODO: CanDelete Authorization
//bool result = false;
//if (Csla.ApplicationContext.User.IsInRole("ProjectManager"))result = true;
//if (Csla.ApplicationContext.User.IsInRole("Administrator"))result = true;
//return result;
return true;
}
public static bool CanEditObject()
{
// TODO: CanEdit Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
#endregion
#region Factory Methods
internal static ConnectionFolder New(string name)
{
return new ConnectionFolder(name);
}
internal static ConnectionFolder Get(SafeDataReader dr)
{
return new ConnectionFolder(dr);
}
private ConnectionFolder()
{
MarkAsChild();
_parentid = ext.DefaultParentid;
_dts = ext.DefaultDts;
_usrid = ext.DefaultUsrid;
}
private ConnectionFolder(string name)
{
MarkAsChild();
// TODO: Add any initialization & defaults
_parentid = ext.DefaultParentid;
_dts = ext.DefaultDts;
_usrid = ext.DefaultUsrid;
_name = name;
}
private ConnectionFolder(SafeDataReader dr)
{
MarkAsChild();
Fetch(dr);
}
#endregion
#region Data Access Portal
private void Fetch(SafeDataReader dr)
{
try
{
_folderid = dr.GetInt32("FolderID");
_parentid = dr.GetInt32("ParentID");
_name = dr.GetString("Name");
_title = dr.GetString("Title");
_config = dr.GetString("Config");
_dts = dr.GetDateTime("DTS");
_usrid = dr.GetString("UsrID");
dr.GetBytes("LastChanged", 0, _lastchanged, 0, 8);
}
catch (Exception ex)
{
Database.LogException("ConnectionFolder", ex);
}
MarkOld();
}
internal void Insert(Connection connection, SqlConnection cn)
{
// if we're not dirty then don't update the database
if (!this.IsDirty) return;
_lastchanged = Folder.Add(cn, ref _folderid, _parentid, connection.Dbid, _name, _title, _config, _dts, _usrid);
MarkOld();
}
internal void Update(Connection connection, SqlConnection cn)
{
// if we're not dirty then don't update the database
if (!this.IsDirty) return;
_lastchanged = Folder.Update(cn, ref _folderid, _parentid, connection.Dbid, _name, _title, _config, _dts, _usrid, ref _lastchanged);
}
internal void DeleteSelf(Connection connection, SqlConnection cn)
{
// if we're not dirty then don't update the database
if (!this.IsDirty) return;
// if we're new then don't update the database
if (this.IsNew) return;
Folder.Remove(cn, _folderid);
MarkNew();
}
#endregion
// Standard Default Code
// #region extension
Extension ext = new Extension();
[Serializable()]
partial class Extension : extensionBase
{
}
[Serializable()]
class extensionBase
{
// Default Values
public virtual int DefaultParentid
{
get { return 0; }
}
public virtual int DefaultDbid
{
get { return 0; }
}
public virtual DateTime DefaultDts
{
get { return DateTime.Now; }
}
public virtual string DefaultUsrid
{
get { return Environment.UserName.ToUpper(); }
}
// Authorization Rules
public virtual void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
{
// Needs to be overriden to add new authorization rules
}
// Validation Rules
public virtual void AddValidationRules(Csla.Validation.ValidationRules rules)
{
// Needs to be overriden to add new validation rules
}
}
//#endregion
// The follwing is a sample Extension File. You can use it to create ConnectionFolderExt.cs
//using System;
//using System.Collections.Generic;
//using System.Text;
//using Csla;
//namespace PatrialClass
//{
// public partial class ConnectionFolder
// {
// partial class Extension : extensionBase
// {
// TODO: Override automatic defaults
// public virtual int DefaultParentid
// {
// get { return 0; }
// }
// public virtual int DefaultDbid
// {
// get { return 0; }
// }
// public virtual DateTime DefaultDts
// {
// get { return DateTime.Now; }
// }
// public virtual string DefaultUsrid
// {
// get { return Environment.UserName.ToUpper(); }
// }
// public new void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
// {
// //rules.AllowRead(Dbid, "<Role(s)>");
// }
// public new void AddValidationRules(Csla.Validation.ValidationRules rules)
// {
// rules.AddRule(
// Csla.Validation.CommonRules.StringMaxLength,
// new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 100));
// }
// }
// }
//}
} // Class
} // Namespace