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.
This commit is contained in:
parent
f2d330bd0e
commit
378653c536
@ -200,6 +200,7 @@
|
|||||||
this.txtResults.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
this.txtResults.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
||||||
this.txtResults.Size = new System.Drawing.Size(489, 473);
|
this.txtResults.Size = new System.Drawing.Size(489, 473);
|
||||||
this.txtResults.TabIndex = 4;
|
this.txtResults.TabIndex = 4;
|
||||||
|
this.txtResults.TextChanged += new System.EventHandler(this.txtResults_TextChanged);
|
||||||
//
|
//
|
||||||
// panel1
|
// panel1
|
||||||
//
|
//
|
||||||
@ -312,6 +313,7 @@
|
|||||||
this.txtProcess.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
this.txtProcess.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
||||||
this.txtProcess.Size = new System.Drawing.Size(291, 375);
|
this.txtProcess.Size = new System.Drawing.Size(291, 375);
|
||||||
this.txtProcess.TabIndex = 5;
|
this.txtProcess.TabIndex = 5;
|
||||||
|
this.txtProcess.TextChanged += new System.EventHandler(this.txtProcess_TextChanged);
|
||||||
//
|
//
|
||||||
// pbProcess
|
// pbProcess
|
||||||
//
|
//
|
||||||
@ -340,7 +342,7 @@
|
|||||||
this.panel3.Dock = System.Windows.Forms.DockStyle.Top;
|
this.panel3.Dock = System.Windows.Forms.DockStyle.Top;
|
||||||
this.panel3.Location = new System.Drawing.Point(0, 23);
|
this.panel3.Location = new System.Drawing.Point(0, 23);
|
||||||
this.panel3.Name = "panel3";
|
this.panel3.Name = "panel3";
|
||||||
this.panel3.Padding = new System.Windows.Forms.Padding(6, 6, 6, 6);
|
this.panel3.Padding = new System.Windows.Forms.Padding(6);
|
||||||
this.panel3.Size = new System.Drawing.Size(291, 79);
|
this.panel3.Size = new System.Drawing.Size(291, 79);
|
||||||
this.panel3.TabIndex = 2;
|
this.panel3.TabIndex = 2;
|
||||||
//
|
//
|
||||||
@ -353,7 +355,7 @@
|
|||||||
this.pnlLater.Enabled = false;
|
this.pnlLater.Enabled = false;
|
||||||
this.pnlLater.Location = new System.Drawing.Point(6, 23);
|
this.pnlLater.Location = new System.Drawing.Point(6, 23);
|
||||||
this.pnlLater.Name = "pnlLater";
|
this.pnlLater.Name = "pnlLater";
|
||||||
this.pnlLater.Padding = new System.Windows.Forms.Padding(6, 6, 6, 6);
|
this.pnlLater.Padding = new System.Windows.Forms.Padding(6);
|
||||||
this.pnlLater.Size = new System.Drawing.Size(279, 37);
|
this.pnlLater.Size = new System.Drawing.Size(279, 37);
|
||||||
this.pnlLater.TabIndex = 3;
|
this.pnlLater.TabIndex = 3;
|
||||||
//
|
//
|
||||||
@ -484,7 +486,7 @@
|
|||||||
this.sideNavItmExit});
|
this.sideNavItmExit});
|
||||||
this.sideNav1.Location = new System.Drawing.Point(0, 0);
|
this.sideNav1.Location = new System.Drawing.Point(0, 0);
|
||||||
this.sideNav1.Name = "sideNav1";
|
this.sideNav1.Name = "sideNav1";
|
||||||
this.sideNav1.Padding = new System.Windows.Forms.Padding(1, 1, 1, 1);
|
this.sideNav1.Padding = new System.Windows.Forms.Padding(1);
|
||||||
this.sideNav1.Size = new System.Drawing.Size(385, 525);
|
this.sideNav1.Size = new System.Drawing.Size(385, 525);
|
||||||
this.sideNav1.TabIndex = 3;
|
this.sideNav1.TabIndex = 3;
|
||||||
this.sideNav1.Text = "sideNav1";
|
this.sideNav1.Text = "sideNav1";
|
||||||
@ -501,7 +503,7 @@
|
|||||||
this.sideNavPanel4.Location = new System.Drawing.Point(81, 31);
|
this.sideNavPanel4.Location = new System.Drawing.Point(81, 31);
|
||||||
this.sideNavPanel4.MinimumSize = new System.Drawing.Size(0, 493);
|
this.sideNavPanel4.MinimumSize = new System.Drawing.Size(0, 493);
|
||||||
this.sideNavPanel4.Name = "sideNavPanel4";
|
this.sideNavPanel4.Name = "sideNavPanel4";
|
||||||
this.sideNavPanel4.Size = new System.Drawing.Size(300, 493);
|
this.sideNavPanel4.Size = new System.Drawing.Size(299, 493);
|
||||||
this.sideNavPanel4.TabIndex = 27;
|
this.sideNavPanel4.TabIndex = 27;
|
||||||
//
|
//
|
||||||
// swDeleteFolder
|
// swDeleteFolder
|
||||||
@ -572,7 +574,7 @@
|
|||||||
this.myTVdel.Dock = System.Windows.Forms.DockStyle.Bottom;
|
this.myTVdel.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||||
this.myTVdel.Location = new System.Drawing.Point(0, 126);
|
this.myTVdel.Location = new System.Drawing.Point(0, 126);
|
||||||
this.myTVdel.Name = "myTVdel";
|
this.myTVdel.Name = "myTVdel";
|
||||||
this.myTVdel.Size = new System.Drawing.Size(300, 367);
|
this.myTVdel.Size = new System.Drawing.Size(299, 367);
|
||||||
this.myTVdel.TabIndex = 34;
|
this.myTVdel.TabIndex = 34;
|
||||||
this.myTVdel.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.myTV_AfterCheck_DelAnn);
|
this.myTVdel.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.myTV_AfterCheck_DelAnn);
|
||||||
//
|
//
|
||||||
@ -585,7 +587,7 @@
|
|||||||
this.btnDeleteItems.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
|
this.btnDeleteItems.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
|
||||||
this.btnDeleteItems.Location = new System.Drawing.Point(39, 98);
|
this.btnDeleteItems.Location = new System.Drawing.Point(39, 98);
|
||||||
this.btnDeleteItems.Name = "btnDeleteItems";
|
this.btnDeleteItems.Name = "btnDeleteItems";
|
||||||
this.btnDeleteItems.Size = new System.Drawing.Size(221, 23);
|
this.btnDeleteItems.Size = new System.Drawing.Size(220, 23);
|
||||||
this.btnDeleteItems.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
this.btnDeleteItems.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||||
this.superTooltip1.SetSuperTooltip(this.btnDeleteItems, new DevComponents.DotNetBar.SuperTooltipInfo("Process Deletions", "", resources.GetString("btnDeleteItems.SuperTooltip"), null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(200, 175)));
|
this.superTooltip1.SetSuperTooltip(this.btnDeleteItems, new DevComponents.DotNetBar.SuperTooltipInfo("Process Deletions", "", resources.GetString("btnDeleteItems.SuperTooltip"), null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(200, 175)));
|
||||||
this.btnDeleteItems.TabIndex = 35;
|
this.btnDeleteItems.TabIndex = 35;
|
||||||
@ -649,7 +651,7 @@
|
|||||||
this.warningBox5.CloseButtonVisible = false;
|
this.warningBox5.CloseButtonVisible = false;
|
||||||
this.warningBox5.Image = ((System.Drawing.Image)(resources.GetObject("warningBox5.Image")));
|
this.warningBox5.Image = ((System.Drawing.Image)(resources.GetObject("warningBox5.Image")));
|
||||||
this.warningBox5.Location = new System.Drawing.Point(17, 145);
|
this.warningBox5.Location = new System.Drawing.Point(17, 145);
|
||||||
this.warningBox5.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
this.warningBox5.Margin = new System.Windows.Forms.Padding(4);
|
||||||
this.warningBox5.Name = "warningBox5";
|
this.warningBox5.Name = "warningBox5";
|
||||||
this.warningBox5.OptionsButtonVisible = false;
|
this.warningBox5.OptionsButtonVisible = false;
|
||||||
this.warningBox5.Size = new System.Drawing.Size(262, 32);
|
this.warningBox5.Size = new System.Drawing.Size(262, 32);
|
||||||
@ -733,7 +735,7 @@
|
|||||||
this.warningBox1.CloseButtonVisible = false;
|
this.warningBox1.CloseButtonVisible = false;
|
||||||
this.warningBox1.Image = ((System.Drawing.Image)(resources.GetObject("warningBox1.Image")));
|
this.warningBox1.Image = ((System.Drawing.Image)(resources.GetObject("warningBox1.Image")));
|
||||||
this.warningBox1.Location = new System.Drawing.Point(17, 181);
|
this.warningBox1.Location = new System.Drawing.Point(17, 181);
|
||||||
this.warningBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
this.warningBox1.Margin = new System.Windows.Forms.Padding(4);
|
||||||
this.warningBox1.Name = "warningBox1";
|
this.warningBox1.Name = "warningBox1";
|
||||||
this.warningBox1.OptionsButtonVisible = false;
|
this.warningBox1.OptionsButtonVisible = false;
|
||||||
this.warningBox1.Size = new System.Drawing.Size(262, 43);
|
this.warningBox1.Size = new System.Drawing.Size(262, 43);
|
||||||
@ -782,7 +784,7 @@
|
|||||||
this.warningBox3.CloseButtonVisible = false;
|
this.warningBox3.CloseButtonVisible = false;
|
||||||
this.warningBox3.Image = ((System.Drawing.Image)(resources.GetObject("warningBox3.Image")));
|
this.warningBox3.Image = ((System.Drawing.Image)(resources.GetObject("warningBox3.Image")));
|
||||||
this.warningBox3.Location = new System.Drawing.Point(17, 207);
|
this.warningBox3.Location = new System.Drawing.Point(17, 207);
|
||||||
this.warningBox3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
this.warningBox3.Margin = new System.Windows.Forms.Padding(4);
|
||||||
this.warningBox3.Name = "warningBox3";
|
this.warningBox3.Name = "warningBox3";
|
||||||
this.warningBox3.OptionsButtonVisible = false;
|
this.warningBox3.OptionsButtonVisible = false;
|
||||||
this.warningBox3.Size = new System.Drawing.Size(264, 32);
|
this.warningBox3.Size = new System.Drawing.Size(264, 32);
|
||||||
@ -986,7 +988,7 @@
|
|||||||
this.warningBox4.CloseButtonVisible = false;
|
this.warningBox4.CloseButtonVisible = false;
|
||||||
this.warningBox4.Image = ((System.Drawing.Image)(resources.GetObject("warningBox4.Image")));
|
this.warningBox4.Image = ((System.Drawing.Image)(resources.GetObject("warningBox4.Image")));
|
||||||
this.warningBox4.Location = new System.Drawing.Point(12, 264);
|
this.warningBox4.Location = new System.Drawing.Point(12, 264);
|
||||||
this.warningBox4.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
this.warningBox4.Margin = new System.Windows.Forms.Padding(4);
|
||||||
this.warningBox4.Name = "warningBox4";
|
this.warningBox4.Name = "warningBox4";
|
||||||
this.warningBox4.OptionsButtonVisible = false;
|
this.warningBox4.OptionsButtonVisible = false;
|
||||||
this.warningBox4.Size = new System.Drawing.Size(264, 32);
|
this.warningBox4.Size = new System.Drawing.Size(264, 32);
|
||||||
@ -999,7 +1001,7 @@
|
|||||||
this.warningBox2.CloseButtonVisible = false;
|
this.warningBox2.CloseButtonVisible = false;
|
||||||
this.warningBox2.Image = ((System.Drawing.Image)(resources.GetObject("warningBox2.Image")));
|
this.warningBox2.Image = ((System.Drawing.Image)(resources.GetObject("warningBox2.Image")));
|
||||||
this.warningBox2.Location = new System.Drawing.Point(12, 302);
|
this.warningBox2.Location = new System.Drawing.Point(12, 302);
|
||||||
this.warningBox2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
this.warningBox2.Margin = new System.Windows.Forms.Padding(4);
|
||||||
this.warningBox2.Name = "warningBox2";
|
this.warningBox2.Name = "warningBox2";
|
||||||
this.warningBox2.OptionsButtonVisible = false;
|
this.warningBox2.OptionsButtonVisible = false;
|
||||||
this.warningBox2.Size = new System.Drawing.Size(264, 43);
|
this.warningBox2.Size = new System.Drawing.Size(264, 43);
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
@ -10,7 +8,6 @@ using System.IO;
|
|||||||
using Volian.Controls.Library;
|
using Volian.Controls.Library;
|
||||||
using DevComponents.DotNetBar;
|
using DevComponents.DotNetBar;
|
||||||
using JR.Utils.GUI.Forms;
|
using JR.Utils.GUI.Forms;
|
||||||
using Volian.Controls.Library;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace VEPROMS
|
namespace VEPROMS
|
||||||
@ -342,6 +339,8 @@ namespace VEPROMS
|
|||||||
pbProcess.PerformStep();
|
pbProcess.PerformStep();
|
||||||
Application.DoEvents();
|
Application.DoEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ClearCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
Application.DoEvents();
|
Application.DoEvents();
|
||||||
@ -389,6 +388,23 @@ namespace VEPROMS
|
|||||||
this.Cursor = Cursors.Default;
|
this.Cursor = Cursors.Default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//C2025-011 RO Update Admin Tool Memory Enhancements
|
||||||
|
//Clear what we can from the cache
|
||||||
|
//runs after each section
|
||||||
|
private void ClearCache()
|
||||||
|
{
|
||||||
|
txtProcess.AppendText("Reclaiming memory used during previous sections.");
|
||||||
|
|
||||||
|
PartInfo.ClearPartInfoCache();
|
||||||
|
ItemInfo.ClearItemInfoCache();
|
||||||
|
Item.ClearItemCache();
|
||||||
|
ContentInfo.ClearContentInfoCache();
|
||||||
|
GridInfo.ClearGridInfoCache();
|
||||||
|
|
||||||
|
GC.Collect();
|
||||||
|
GC.WaitForPendingFinalizers();
|
||||||
|
}
|
||||||
|
|
||||||
//C2022-028 check for Bad RO Links - we will check all of the RO links found in procedure step text
|
//C2022-028 check for Bad RO Links - we will check all of the RO links found in procedure step text
|
||||||
//B2022-144 Allow to check individual procedures for bad RO links
|
//B2022-144 Allow to check individual procedures for bad RO links
|
||||||
private void CheckROLinks()
|
private void CheckROLinks()
|
||||||
@ -1002,6 +1018,9 @@ namespace VEPROMS
|
|||||||
txtResults.AppendText(Environment.NewLine);
|
txtResults.AppendText(Environment.NewLine);
|
||||||
txtResults.AppendText(Environment.NewLine);
|
txtResults.AppendText(Environment.NewLine);
|
||||||
}
|
}
|
||||||
|
//C2025-011 RO Update Admin Tool Memory Enhancements
|
||||||
|
//clear the list since no longer using it
|
||||||
|
myItems.Clear();
|
||||||
DateTime pEnd = DateTime.Now;
|
DateTime pEnd = DateTime.Now;
|
||||||
txtProcess.AppendText(string.Format("Completed: {0}", pEnd.ToString("MM/dd/yyyy @ HH:mm")));
|
txtProcess.AppendText(string.Format("Completed: {0}", pEnd.ToString("MM/dd/yyyy @ HH:mm")));
|
||||||
txtProcess.AppendText(Environment.NewLine);
|
txtProcess.AppendText(Environment.NewLine);
|
||||||
@ -1088,6 +1107,7 @@ namespace VEPROMS
|
|||||||
}
|
}
|
||||||
roFstInfo.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
|
roFstInfo.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
|
||||||
ROFst newrofst = ROFstInfo.RefreshROFst(dv, roFstInfo, DoProgressBarRefresh, txtProcess);
|
ROFst newrofst = ROFstInfo.RefreshROFst(dv, roFstInfo, DoProgressBarRefresh, txtProcess);
|
||||||
|
//ROFst newrofst = ROFstInfo.RefreshROFst(dv, roFstInfo, DoProgressBarRefresh, null);
|
||||||
roFstInfo.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
|
roFstInfo.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1976,7 +1996,20 @@ namespace VEPROMS
|
|||||||
pil.Add(myProcedures[tn]);
|
pil.Add(myProcedures[tn]);
|
||||||
return pil;
|
return pil;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
//C2025-011 RO Update Admin Tool Memory Enhancements
|
||||||
|
private void txtProcess_TextChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
//clears the stack to help with memory - should never need to undo text changes to this.
|
||||||
|
txtProcess.ClearUndo();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void txtResults_TextChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
//clears the stack to help with memory - should never need to undo text changes to this.
|
||||||
|
txtResults.ClearUndo();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,29 +49,35 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
if (DocVersionAssociations == null || DocVersionAssociations.Count == 0) return false;
|
if (DocVersionAssociations == null || DocVersionAssociations.Count == 0) return false;
|
||||||
|
|
||||||
ROFstInfo roFstInfo = ROFstInfo.GetJustROFst(DocVersionAssociations[0].ROFstID);
|
using (ROFstInfo roFstInfo = ROFstInfo.GetJustROFst(DocVersionAssociations[0].ROFstID))
|
||||||
|
{
|
||||||
|
using (RODbInfo rdi = RODbInfo.GetJustRODB(roFstInfo.RODbID))
|
||||||
|
{
|
||||||
|
string rofstPath = rdi.FolderPath + @"\ro.fst";
|
||||||
|
if (!File.Exists(rofstPath)) return false;
|
||||||
|
|
||||||
RODbInfo rdi = RODbInfo.GetJustRODB(roFstInfo.RODbID);
|
FileInfo fiRofst = new FileInfo(rofstPath);
|
||||||
string rofstPath = rdi.FolderPath + @"\ro.fst";
|
|
||||||
if (!File.Exists(rofstPath)) return false;
|
|
||||||
|
|
||||||
FileInfo fiRofst = new FileInfo(rofstPath);
|
// if the database Ro.Fst is newer or if the files have identical DTS,
|
||||||
|
// assume that they are the same file.
|
||||||
|
if (roFstInfo.DTS >= fiRofst.LastWriteTimeUtc) return false;
|
||||||
|
|
||||||
// if the database Ro.Fst is newer or if the files have identical DTS,
|
// next see if the data is the same size, i.e. byte count of record and byte count
|
||||||
// assume that they are the same file.
|
// of file. If different sizes, the date/time stamp check will hold.
|
||||||
if (roFstInfo.DTS >= fiRofst.LastWriteTimeUtc) return false;
|
// B2022-026 RO Memory reduction - new logic
|
||||||
|
var bytes = ROFSTLookup.GetRofstLookupBytes(roFstInfo.ROFstID);
|
||||||
|
|
||||||
// next see if the data is the same size, i.e. byte count of record and byte count
|
if (bytes != null && fiRofst.Length != bytes.Length)
|
||||||
// of file. If different sizes, the date/time stamp check will hold.
|
return fiRofst.LastWriteTimeUtc > roFstInfo.DTS;
|
||||||
// B2022-026 RO Memory reduction - new logic
|
|
||||||
var bytes = ROFSTLookup.GetRofstLookupBytes(roFstInfo.ROFstID);
|
// if we can't tell by the DTS or size, compare the contents. Get all of the rodb's
|
||||||
|
// rofsts of the size of the file & compare bytes.
|
||||||
|
return ROFstInfoList.ROFstDiffBySize(rofstPath, rdi.RODbID, (int)fiRofst.Length);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (bytes != null && fiRofst.Length != bytes.Length)
|
|
||||||
return fiRofst.LastWriteTimeUtc > roFstInfo.DTS;
|
|
||||||
|
|
||||||
// if we can't tell by the DTS or size, compare the contents. Get all of the rodb's
|
|
||||||
// rofsts of the size of the file & compare bytes.
|
|
||||||
return ROFstInfoList.ROFstDiffBySize(rofstPath, rdi.RODbID, (int)fiRofst.Length);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public bool ROfstLastCompleted
|
public bool ROfstLastCompleted
|
||||||
|
@ -40,6 +40,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
Console.WriteLine("- - - - - -");
|
Console.WriteLine("- - - - - -");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//C2025-011 RO Update Admin Tool Memory Enhancements
|
||||||
|
//clears everything in cache - to run between sections in the Admin Tool to reclaim memory
|
||||||
|
public static void ClearItemCache()
|
||||||
|
{
|
||||||
|
_CacheByPrimaryKey.Clear();
|
||||||
|
while (_CacheList.Count > 0)
|
||||||
|
{
|
||||||
|
_CacheList[0].DisposeOfContent = true;
|
||||||
|
_CacheList[0].Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return string.Format("{0} {1}", MyContent.Number, MyContent.Text).Trim();
|
return string.Format("{0} {1}", MyContent.Number, MyContent.Text).Trim();
|
||||||
@ -326,6 +337,32 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region ItemInfo
|
#region ItemInfo
|
||||||
public partial class ItemInfo : IVEDrillDownReadOnly
|
public partial class ItemInfo : IVEDrillDownReadOnly
|
||||||
{
|
{
|
||||||
|
|
||||||
|
//C2025-011 RO Update Admin Tool Memory Enhancements
|
||||||
|
//clears everything in cache - to run between sections in the Admin Tool to reclaim memory
|
||||||
|
public static void ClearItemInfoCache()
|
||||||
|
{
|
||||||
|
while (_CacheByPrimaryKey.Count > 0)
|
||||||
|
{
|
||||||
|
var ii = _CacheByPrimaryKey.FirstOrDefault();
|
||||||
|
|
||||||
|
while (ii.Value.Count > 0)
|
||||||
|
{
|
||||||
|
if (ii.Value[0]?.MyContent?.ContentParts != null)
|
||||||
|
{ foreach (PartInfo pi in ii.Value[0]?.MyContent?.ContentParts) pi.Dispose(); }
|
||||||
|
ii.Value[0].Dispose();
|
||||||
|
}
|
||||||
|
_CacheByPrimaryKey.Remove(ii.Key);
|
||||||
|
}
|
||||||
|
|
||||||
|
while (_CacheList.Count > 0)
|
||||||
|
{
|
||||||
|
if (_CacheList[0]?.MyContent?.ContentParts != null)
|
||||||
|
{foreach (PartInfo pi in _CacheList[0]?.MyContent?.ContentParts) pi.Dispose(); }
|
||||||
|
_CacheList[0].Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private bool _PrintAllAtOnce = false;
|
private bool _PrintAllAtOnce = false;
|
||||||
|
|
||||||
public bool PrintAllAtOnce
|
public bool PrintAllAtOnce
|
||||||
@ -2491,15 +2528,19 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public ItemInfo LastChild(E_FromType partType)
|
public ItemInfo LastChild(E_FromType partType)
|
||||||
{
|
{
|
||||||
ItemInfoList myitems = Lookup((int)partType);
|
using (ItemInfoList myitems = Lookup((int)partType))
|
||||||
if (myitems != null) return myitems[myitems.Count - 1];
|
{
|
||||||
return null;
|
if (myitems != null) return myitems[myitems.Count - 1];
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public ItemInfo FirstChild(E_FromType partType)
|
public ItemInfo FirstChild(E_FromType partType)
|
||||||
{
|
{
|
||||||
ItemInfoList myitems = Lookup((int)partType);
|
using (ItemInfoList myitems = Lookup((int)partType))
|
||||||
if (myitems != null) return myitems[0];
|
{
|
||||||
return null;
|
if (myitems != null) return myitems[0];
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public bool HasAncestor(ItemInfo ancestor)
|
public bool HasAncestor(ItemInfo ancestor)
|
||||||
{
|
{
|
||||||
@ -3863,30 +3904,33 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region IVEReadOnlyItem
|
#region IVEReadOnlyItem
|
||||||
PartInfoList _PartInfoList;
|
|
||||||
public System.Collections.IList GetChildren()
|
public System.Collections.IList GetChildren()
|
||||||
{
|
{
|
||||||
_PartInfoList = this.MyContent.ContentParts;
|
using (PartInfoList _PartInfoList = this.MyContent.ContentParts)
|
||||||
if (_PartInfoList.Count == 1 && ((IsProcedure && _PartInfoList[0].ToString() == "Sections") || _PartInfoList[0].ToString() == "Steps"))
|
|
||||||
return _PartInfoList[0].GetChildren();
|
|
||||||
return _PartInfoList;
|
|
||||||
}
|
|
||||||
public System.Collections.IList GetChildren(bool allParts)
|
|
||||||
{
|
|
||||||
_PartInfoList = this.MyContent.ContentParts;
|
|
||||||
if (allParts)
|
|
||||||
{
|
{
|
||||||
if (_PartInfoList.Count == 1 && ((IsProcedure && _PartInfoList[0].ToString() == "Sections") || _PartInfoList[0].ToString() == "Steps"))
|
if (_PartInfoList.Count == 1 && ((IsProcedure && _PartInfoList[0].ToString() == "Sections") || _PartInfoList[0].ToString() == "Steps"))
|
||||||
|
|
||||||
return _PartInfoList[0].GetChildren();
|
return _PartInfoList[0].GetChildren();
|
||||||
return _PartInfoList;
|
return _PartInfoList;
|
||||||
}
|
}
|
||||||
else // Steps and Sections only
|
}
|
||||||
{
|
public System.Collections.IList GetChildren(bool allParts)
|
||||||
for (int i = 0; i < _PartInfoList.Count; i++)
|
{
|
||||||
if (_PartInfoList[i].ToString() == "Sections" || _PartInfoList[i].ToString() == "Steps")
|
using (PartInfoList _PartInfoList = this.MyContent.ContentParts)
|
||||||
return _PartInfoList[i].GetChildren();
|
{
|
||||||
return null;
|
if (allParts)
|
||||||
|
{
|
||||||
|
if (_PartInfoList.Count == 1 && ((IsProcedure && _PartInfoList[0].ToString() == "Sections") || _PartInfoList[0].ToString() == "Steps"))
|
||||||
|
|
||||||
|
return _PartInfoList[0].GetChildren();
|
||||||
|
return _PartInfoList;
|
||||||
|
}
|
||||||
|
else // Steps and Sections only
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _PartInfoList.Count; i++)
|
||||||
|
if (_PartInfoList[i].ToString() == "Sections" || _PartInfoList[i].ToString() == "Steps")
|
||||||
|
return _PartInfoList[i].GetChildren();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//public bool ChildrenAreLoaded
|
//public bool ChildrenAreLoaded
|
||||||
@ -6185,8 +6229,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new MoveItemCriteria(itemID, index));
|
using (ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new MoveItemCriteria(itemID, index)))
|
||||||
return tmp;
|
{ return tmp; }
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -6198,13 +6242,15 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListCriteria(itemID, type));
|
using (ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListCriteria(itemID, type)))
|
||||||
ItemInfo.AddList(tmp);
|
{
|
||||||
tmp.AddEvents();
|
ItemInfo.AddList(tmp);
|
||||||
#if (!ItemWithContent) // If ItemWithContent is set, the content is returned with the ItemInfoList
|
tmp.AddEvents();
|
||||||
ContentInfoList.GetList(itemID); // Performance - Load All Content
|
#if (!ItemWithContent) // If ItemWithContent is set, the content is returned with the ItemInfoList
|
||||||
#endif
|
ContentInfoList.GetList(itemID); // Performance - Load All Content
|
||||||
return tmp;
|
#endif
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -6215,13 +6261,16 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemTranToListCriteria());
|
using (ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemTranToListCriteria()))
|
||||||
ItemInfo.AddList(tmp);
|
{
|
||||||
tmp.AddEvents();
|
ItemInfo.AddList(tmp);
|
||||||
#if (!ItemWithContent) // If ItemWithContent is set, the content is returned with the ItemInfoList
|
tmp.AddEvents();
|
||||||
ContentInfoList.GetList(itemID); // Performance - Load All Content
|
#if (!ItemWithContent) // If ItemWithContent is set, the content is returned with the ItemInfoList
|
||||||
#endif
|
ContentInfoList.GetList(itemID); // Performance - Load All Content
|
||||||
return tmp;
|
#endif
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -6232,13 +6281,15 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemTranFromListCriteria());
|
using (ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemTranFromListCriteria()))
|
||||||
ItemInfo.AddList(tmp);
|
{
|
||||||
tmp.AddEvents();
|
ItemInfo.AddList(tmp);
|
||||||
#if (!ItemWithContent) // If ItemWithContent is set, the content is returned with the ItemInfoList
|
tmp.AddEvents();
|
||||||
ContentInfoList.GetList(itemID); // Performance - Load All Content
|
#if (!ItemWithContent) // If ItemWithContent is set, the content is returned with the ItemInfoList
|
||||||
#endif
|
ContentInfoList.GetList(itemID); // Performance - Load All Content
|
||||||
return tmp;
|
#endif
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -6249,13 +6300,15 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListPartTypeCriteria(fromType));
|
using (ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListPartTypeCriteria(fromType)))
|
||||||
ItemInfo.AddList(tmp);
|
{
|
||||||
tmp.AddEvents();
|
ItemInfo.AddList(tmp);
|
||||||
#if (!ItemWithContent) // If ItemWithContent is set, the content is returned with the ItemInfoList
|
tmp.AddEvents();
|
||||||
ContentInfoList.GetList(itemID); // Performance - Load All Content
|
#if (!ItemWithContent) // If ItemWithContent is set, the content is returned with the ItemInfoList
|
||||||
#endif
|
ContentInfoList.GetList(itemID); // Performance - Load All Content
|
||||||
return tmp;
|
#endif
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -6740,8 +6793,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListEnhancedTextDifferencesCriteria(procItem.ItemID));
|
using (ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListEnhancedTextDifferencesCriteria(procItem.ItemID)))
|
||||||
return tmp;
|
{ return tmp; }
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -6809,8 +6862,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListEnhancedMissingCriteria(srcItem.ItemID, enhType));
|
using (ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListEnhancedMissingCriteria(srcItem.ItemID, enhType)))
|
||||||
return tmp;
|
{ return tmp; }
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -6879,11 +6932,13 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListSearchCriteria(docVersionList, stepTypeList, searchString, caseSensitive, includeLinks, includeRtfFormatting, includeSpecialCharacters, unitPrefix, byWordPrefix, byWordSuffix));
|
using (ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListSearchCriteria(docVersionList, stepTypeList, searchString, caseSensitive, includeLinks, includeRtfFormatting, includeSpecialCharacters, unitPrefix, byWordPrefix, byWordSuffix)))
|
||||||
tmp.SourceOfList = "Search";
|
{
|
||||||
ItemInfo.AddList(tmp);
|
tmp.SourceOfList = "Search";
|
||||||
tmp.AddEvents();
|
ItemInfo.AddList(tmp);
|
||||||
return tmp;
|
tmp.AddEvents();
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -7038,10 +7093,12 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListROSearchCriteria(docVersionList, stepTypeList, roSearchString, unitPrefix));
|
using (ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListROSearchCriteria(docVersionList, stepTypeList, roSearchString, unitPrefix)))
|
||||||
ItemInfo.AddList(tmp);
|
{
|
||||||
tmp.AddEvents();
|
ItemInfo.AddList(tmp);
|
||||||
return tmp;
|
tmp.AddEvents();
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -7142,10 +7199,12 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListAnnotationSearchCriteria(docVersionList, stepTypeList, annotationTypeList, searchString, caseSensitive, unitPrefix));
|
using (ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListAnnotationSearchCriteria(docVersionList, stepTypeList, annotationTypeList, searchString, caseSensitive, unitPrefix)))
|
||||||
ItemInfo.AddList(tmp);
|
{
|
||||||
tmp.AddEvents();
|
ItemInfo.AddList(tmp);
|
||||||
return tmp;
|
tmp.AddEvents();
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -7266,10 +7325,12 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListTransitionSearchCriteria(docVersionList, tranType, tranCategory, stepTypeList));
|
using (ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListTransitionSearchCriteria(docVersionList, tranType, tranCategory, stepTypeList)))
|
||||||
ItemInfo.AddList(tmp);
|
{
|
||||||
tmp.AddEvents();
|
ItemInfo.AddList(tmp);
|
||||||
return tmp;
|
tmp.AddEvents();
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -7355,10 +7416,12 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListROReportCriteria(docVersionList, stepTypeList, roSearchString, unitPrefix));
|
using (ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListROReportCriteria(docVersionList, stepTypeList, roSearchString, unitPrefix)))
|
||||||
ItemInfo.AddList(tmp);
|
{
|
||||||
tmp.AddEvents();
|
ItemInfo.AddList(tmp);
|
||||||
return tmp;
|
tmp.AddEvents();
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -7460,11 +7523,13 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListApplicabilitySearchCriteria(docVersionList, stepTypeList, searchString, caseSensitive, includeLinks, includeRtfFormatting, includeSpecialCharacters, unitPrefix, applicSetting));
|
using (ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListApplicabilitySearchCriteria(docVersionList, stepTypeList, searchString, caseSensitive, includeLinks, includeRtfFormatting, includeSpecialCharacters, unitPrefix, applicSetting)))
|
||||||
tmp.SourceOfList = "Search";
|
{
|
||||||
ItemInfo.AddList(tmp);
|
tmp.SourceOfList = "Search";
|
||||||
tmp.AddEvents();
|
ItemInfo.AddList(tmp);
|
||||||
return tmp;
|
tmp.AddEvents();
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -8114,27 +8179,30 @@ namespace VEPROMS.CSLA.Library
|
|||||||
|
|
||||||
// get list of differences from sql. This list does not resolve links and may have other rtf commands.
|
// get list of differences from sql. This list does not resolve links and may have other rtf commands.
|
||||||
// also this list is source items, not enhanced.
|
// also this list is source items, not enhanced.
|
||||||
ItemInfoList iil = ItemInfoList.GetListEnhancedTextDifferences(this);
|
|
||||||
if (iil == null || iil.Count == 0) return null; // no differences were found.
|
|
||||||
|
|
||||||
// from sql list, get display text of source items & compare to this procedure's items. This
|
using (ItemInfoList iil = ItemInfoList.GetListEnhancedTextDifferences(this))
|
||||||
// will determine true 'text' differences. Then return this list.
|
|
||||||
ItemInfoList retiil = null; // new ItemInfoList(null);
|
|
||||||
foreach (ItemInfo ii in iil)
|
|
||||||
{
|
{
|
||||||
EnhancedDocuments seds = ii.GetMyEnhancedDocuments();
|
if (iil == null || iil.Count == 0) return null; // no differences were found.
|
||||||
if (seds != null && seds.Count != 0)
|
|
||||||
|
// from sql list, get display text of source items & compare to this procedure's items. This
|
||||||
|
// will determine true 'text' differences. Then return this list.
|
||||||
|
ItemInfoList retiil = null; // new ItemInfoList(null);
|
||||||
|
foreach (ItemInfo ii in iil)
|
||||||
{
|
{
|
||||||
|
EnhancedDocuments seds = ii.GetMyEnhancedDocuments();
|
||||||
|
if (seds != null && seds.Count != 0)
|
||||||
|
{
|
||||||
ItemInfo srcItem = ItemInfo.Get(seds[0].ItemID);
|
ItemInfo srcItem = ItemInfo.Get(seds[0].ItemID);
|
||||||
// B2022-049: Copy/paste of enhanced procedure and bad links between source and enhanced. Null reference check
|
// B2022-049: Copy/paste of enhanced procedure and bad links between source and enhanced. Null reference check
|
||||||
if (srcItem != null && srcItem.DisplayTextKeepSpecialChars != ii.DisplayTextKeepSpecialChars)
|
if (srcItem != null && srcItem.DisplayTextKeepSpecialChars != ii.DisplayTextKeepSpecialChars)
|
||||||
{
|
{
|
||||||
if (retiil == null) retiil = new ItemInfoList(ii);
|
if (retiil == null) retiil = new ItemInfoList(ii);
|
||||||
else retiil.AddItem(ii);
|
else retiil.AddItem(ii);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return retiil;
|
||||||
}
|
}
|
||||||
return retiil;
|
|
||||||
}
|
}
|
||||||
public void EnhancedProcedureRefreshTextDifferences(ItemInfoList iil)
|
public void EnhancedProcedureRefreshTextDifferences(ItemInfoList iil)
|
||||||
{
|
{
|
||||||
|
@ -84,7 +84,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("LastChanged", true);
|
|
||||||
return _LastChanged;
|
return _LastChanged;
|
||||||
}
|
}
|
||||||
set { _LastChanged = value; }
|
set { _LastChanged = value; }
|
||||||
|
@ -80,7 +80,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("LastChanged", true);
|
|
||||||
return _LastChanged;
|
return _LastChanged;
|
||||||
}
|
}
|
||||||
set { _LastChanged = value; }
|
set { _LastChanged = value; }
|
||||||
|
@ -108,7 +108,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("AnnotationID", true);
|
|
||||||
return _AnnotationID;
|
return _AnnotationID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -118,7 +117,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("ItemID", true);
|
|
||||||
if (_MyItem != null) _ItemID = _MyItem.ItemID;
|
if (_MyItem != null) _ItemID = _MyItem.ItemID;
|
||||||
return _ItemID;
|
return _ItemID;
|
||||||
}
|
}
|
||||||
@ -129,14 +127,12 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("MyItem", true);
|
|
||||||
if (_MyItem == null && _ItemID != 0) _MyItem = Item.Get(_ItemID);
|
if (_MyItem == null && _ItemID != 0) _MyItem = Item.Get(_ItemID);
|
||||||
return _MyItem;
|
return _MyItem;
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CanWriteProperty("MyItem", true);
|
|
||||||
if (_MyItem != value)
|
if (_MyItem != value)
|
||||||
{
|
{
|
||||||
_MyItem = value;
|
_MyItem = value;
|
||||||
@ -151,7 +147,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("TypeID", true);
|
|
||||||
if (_MyAnnotationType != null) _TypeID = _MyAnnotationType.TypeID;
|
if (_MyAnnotationType != null) _TypeID = _MyAnnotationType.TypeID;
|
||||||
return _TypeID;
|
return _TypeID;
|
||||||
}
|
}
|
||||||
@ -162,14 +157,12 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("MyAnnotationType", true);
|
|
||||||
if (_MyAnnotationType == null && _TypeID != 0) _MyAnnotationType = AnnotationType.Get(_TypeID);
|
if (_MyAnnotationType == null && _TypeID != 0) _MyAnnotationType = AnnotationType.Get(_TypeID);
|
||||||
return _MyAnnotationType;
|
return _MyAnnotationType;
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CanWriteProperty("MyAnnotationType", true);
|
|
||||||
if (_MyAnnotationType != value)
|
if (_MyAnnotationType != value)
|
||||||
{
|
{
|
||||||
_MyAnnotationType = value;
|
_MyAnnotationType = value;
|
||||||
@ -184,13 +177,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("RtfText", true);
|
|
||||||
return _RtfText;
|
return _RtfText;
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CanWriteProperty("RtfText", true);
|
|
||||||
if (value == null) value = string.Empty;
|
if (value == null) value = string.Empty;
|
||||||
if (_RtfText != value)
|
if (_RtfText != value)
|
||||||
{
|
{
|
||||||
@ -205,13 +196,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("SearchText", true);
|
|
||||||
return _SearchText;
|
return _SearchText;
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CanWriteProperty("SearchText", true);
|
|
||||||
if (value == null) value = string.Empty;
|
if (value == null) value = string.Empty;
|
||||||
if (_SearchText != value)
|
if (_SearchText != value)
|
||||||
{
|
{
|
||||||
@ -226,13 +215,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("Config", true);
|
|
||||||
return _Config;
|
return _Config;
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CanWriteProperty("Config", true);
|
|
||||||
if (value == null) value = string.Empty;
|
if (value == null) value = string.Empty;
|
||||||
if (_Config != value)
|
if (_Config != value)
|
||||||
{
|
{
|
||||||
@ -247,13 +234,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("DTS", true);
|
|
||||||
return _DTS;
|
return _DTS;
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CanWriteProperty("DTS", true);
|
|
||||||
if (_DTS != value)
|
if (_DTS != value)
|
||||||
{
|
{
|
||||||
_DTS = value;
|
_DTS = value;
|
||||||
@ -267,13 +252,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("UserID", true);
|
|
||||||
return _UserID;
|
return _UserID;
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CanWriteProperty("UserID", true);
|
|
||||||
if (value == null) value = string.Empty;
|
if (value == null) value = string.Empty;
|
||||||
if (_UserID != value)
|
if (_UserID != value)
|
||||||
{
|
{
|
||||||
|
@ -106,7 +106,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("AuditID", true);
|
|
||||||
return _AuditID;
|
return _AuditID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -116,13 +115,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("AnnotationID", true);
|
|
||||||
return _AnnotationID;
|
return _AnnotationID;
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CanWriteProperty("AnnotationID", true);
|
|
||||||
if (_AnnotationID != value)
|
if (_AnnotationID != value)
|
||||||
{
|
{
|
||||||
_AnnotationID = value;
|
_AnnotationID = value;
|
||||||
@ -136,13 +133,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("ItemID", true);
|
|
||||||
return _ItemID;
|
return _ItemID;
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CanWriteProperty("ItemID", true);
|
|
||||||
if (_ItemID != value)
|
if (_ItemID != value)
|
||||||
{
|
{
|
||||||
_ItemID = value;
|
_ItemID = value;
|
||||||
@ -156,13 +151,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("TypeID", true);
|
|
||||||
return _TypeID;
|
return _TypeID;
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CanWriteProperty("TypeID", true);
|
|
||||||
if (_TypeID != value)
|
if (_TypeID != value)
|
||||||
{
|
{
|
||||||
_TypeID = value;
|
_TypeID = value;
|
||||||
@ -176,13 +169,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("RtfText", true);
|
|
||||||
return _RtfText;
|
return _RtfText;
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CanWriteProperty("RtfText", true);
|
|
||||||
if (value == null) value = string.Empty;
|
if (value == null) value = string.Empty;
|
||||||
if (_RtfText != value)
|
if (_RtfText != value)
|
||||||
{
|
{
|
||||||
@ -197,13 +188,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("SearchText", true);
|
|
||||||
return _SearchText;
|
return _SearchText;
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CanWriteProperty("SearchText", true);
|
|
||||||
if (value == null) value = string.Empty;
|
if (value == null) value = string.Empty;
|
||||||
if (_SearchText != value)
|
if (_SearchText != value)
|
||||||
{
|
{
|
||||||
@ -218,13 +207,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("Config", true);
|
|
||||||
return _Config;
|
return _Config;
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CanWriteProperty("Config", true);
|
|
||||||
if (value == null) value = string.Empty;
|
if (value == null) value = string.Empty;
|
||||||
if (_Config != value)
|
if (_Config != value)
|
||||||
{
|
{
|
||||||
@ -239,13 +226,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("DTS", true);
|
|
||||||
return _DTS;
|
return _DTS;
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CanWriteProperty("DTS", true);
|
|
||||||
if (_DTS != value)
|
if (_DTS != value)
|
||||||
{
|
{
|
||||||
_DTS = value;
|
_DTS = value;
|
||||||
@ -259,13 +244,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("UserID", true);
|
|
||||||
return _UserID;
|
return _UserID;
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CanWriteProperty("UserID", true);
|
|
||||||
if (value == null) value = string.Empty;
|
if (value == null) value = string.Empty;
|
||||||
if (_UserID != value)
|
if (_UserID != value)
|
||||||
{
|
{
|
||||||
@ -280,13 +263,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("DeleteStatus", true);
|
|
||||||
return _DeleteStatus;
|
return _DeleteStatus;
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CanWriteProperty("DeleteStatus", true);
|
|
||||||
if (_DeleteStatus != value)
|
if (_DeleteStatus != value)
|
||||||
{
|
{
|
||||||
_DeleteStatus = value;
|
_DeleteStatus = value;
|
||||||
|
@ -96,7 +96,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("AuditID", true);
|
|
||||||
return _AuditID;
|
return _AuditID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -106,7 +105,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("AnnotationID", true);
|
|
||||||
return _AnnotationID;
|
return _AnnotationID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -116,7 +114,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("ItemID", true);
|
|
||||||
return _ItemID;
|
return _ItemID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -126,7 +123,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("TypeID", true);
|
|
||||||
return _TypeID;
|
return _TypeID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -136,7 +132,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("RtfText", true);
|
|
||||||
return _RtfText;
|
return _RtfText;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -146,7 +141,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("SearchText", true);
|
|
||||||
return _SearchText;
|
return _SearchText;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -156,7 +150,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("Config", true);
|
|
||||||
return _Config;
|
return _Config;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -166,7 +159,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("DTS", true);
|
|
||||||
return _DTS;
|
return _DTS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -176,7 +168,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("UserID", true);
|
|
||||||
return _UserID;
|
return _UserID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -186,7 +177,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("DeleteStatus", true);
|
|
||||||
return _DeleteStatus;
|
return _DeleteStatus;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("AnnotationID", true);
|
|
||||||
return _AnnotationID;
|
return _AnnotationID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -119,7 +118,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("ItemID", true);
|
|
||||||
if (_MyItem != null) _ItemID = _MyItem.ItemID;
|
if (_MyItem != null) _ItemID = _MyItem.ItemID;
|
||||||
return _ItemID;
|
return _ItemID;
|
||||||
}
|
}
|
||||||
@ -130,7 +128,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("MyItem", true);
|
|
||||||
if (_MyItem == null && _ItemID != 0) _MyItem = ItemInfo.Get(_ItemID);
|
if (_MyItem == null && _ItemID != 0) _MyItem = ItemInfo.Get(_ItemID);
|
||||||
return _MyItem;
|
return _MyItem;
|
||||||
}
|
}
|
||||||
@ -141,7 +138,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("TypeID", true);
|
|
||||||
if (_MyAnnotationType != null) _TypeID = _MyAnnotationType.TypeID;
|
if (_MyAnnotationType != null) _TypeID = _MyAnnotationType.TypeID;
|
||||||
return _TypeID;
|
return _TypeID;
|
||||||
}
|
}
|
||||||
@ -152,7 +148,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("MyAnnotationType", true);
|
|
||||||
if (_MyAnnotationType == null && _TypeID != 0) _MyAnnotationType = AnnotationTypeInfo.Get(_TypeID);
|
if (_MyAnnotationType == null && _TypeID != 0) _MyAnnotationType = AnnotationTypeInfo.Get(_TypeID);
|
||||||
return _MyAnnotationType;
|
return _MyAnnotationType;
|
||||||
}
|
}
|
||||||
@ -163,7 +158,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("RtfText", true);
|
|
||||||
return _RtfText;
|
return _RtfText;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -173,7 +167,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("SearchText", true);
|
|
||||||
return _SearchText;
|
return _SearchText;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -183,7 +176,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("Config", true);
|
|
||||||
return _Config;
|
return _Config;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -193,7 +185,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("DTS", true);
|
|
||||||
return _DTS;
|
return _DTS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -203,7 +194,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("UserID", true);
|
|
||||||
return _UserID;
|
return _UserID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("TypeID", true);
|
|
||||||
return _TypeID;
|
return _TypeID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -139,13 +138,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("Name", true);
|
|
||||||
return _Name;
|
return _Name;
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CanWriteProperty("Name", true);
|
|
||||||
if (value == null) value = string.Empty;
|
if (value == null) value = string.Empty;
|
||||||
if (_Name != value)
|
if (_Name != value)
|
||||||
{
|
{
|
||||||
@ -160,13 +157,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("Config", true);
|
|
||||||
return _Config;
|
return _Config;
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CanWriteProperty("Config", true);
|
|
||||||
if (value == null) value = string.Empty;
|
if (value == null) value = string.Empty;
|
||||||
if (_Config != value)
|
if (_Config != value)
|
||||||
{
|
{
|
||||||
@ -181,13 +176,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("DTS", true);
|
|
||||||
return _DTS;
|
return _DTS;
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CanWriteProperty("DTS", true);
|
|
||||||
if (_DTS != value)
|
if (_DTS != value)
|
||||||
{
|
{
|
||||||
_DTS = value;
|
_DTS = value;
|
||||||
@ -201,13 +194,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("UserID", true);
|
|
||||||
return _UserID;
|
return _UserID;
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CanWriteProperty("UserID", true);
|
|
||||||
if (value == null) value = string.Empty;
|
if (value == null) value = string.Empty;
|
||||||
if (_UserID != value)
|
if (_UserID != value)
|
||||||
{
|
{
|
||||||
@ -226,7 +217,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("AnnotationTypeAnnotationCount", true);
|
|
||||||
return _AnnotationTypeAnnotationCount;
|
return _AnnotationTypeAnnotationCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -240,7 +230,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("AnnotationTypeAnnotations", true);
|
|
||||||
if (_AnnotationTypeAnnotationCount < 0 || (_AnnotationTypeAnnotationCount > 0 && _AnnotationTypeAnnotations == null))
|
if (_AnnotationTypeAnnotationCount < 0 || (_AnnotationTypeAnnotationCount > 0 && _AnnotationTypeAnnotations == null))
|
||||||
_AnnotationTypeAnnotations = AnnotationTypeAnnotations.GetByTypeID(TypeID);
|
_AnnotationTypeAnnotations = AnnotationTypeAnnotations.GetByTypeID(TypeID);
|
||||||
if (_AnnotationTypeAnnotationCount < 0 )
|
if (_AnnotationTypeAnnotationCount < 0 )
|
||||||
|
@ -43,7 +43,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("AnnotationID", true);
|
|
||||||
if (_MyAnnotation != null) _AnnotationID = _MyAnnotation.AnnotationID;
|
if (_MyAnnotation != null) _AnnotationID = _MyAnnotation.AnnotationID;
|
||||||
return _AnnotationID;
|
return _AnnotationID;
|
||||||
}
|
}
|
||||||
@ -55,7 +54,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("MyAnnotation", true);
|
|
||||||
if (_MyAnnotation == null && _AnnotationID != 0) _MyAnnotation = Annotation.Get(_AnnotationID);
|
if (_MyAnnotation == null && _AnnotationID != 0) _MyAnnotation = Annotation.Get(_AnnotationID);
|
||||||
return _MyAnnotation;
|
return _MyAnnotation;
|
||||||
}
|
}
|
||||||
@ -66,7 +64,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("ItemID", true);
|
|
||||||
if (_MyItem != null) _ItemID = _MyItem.ItemID;
|
if (_MyItem != null) _ItemID = _MyItem.ItemID;
|
||||||
return _ItemID;
|
return _ItemID;
|
||||||
}
|
}
|
||||||
@ -77,14 +74,12 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("MyItem", true);
|
|
||||||
if (_MyItem == null && _ItemID != 0) _MyItem = Item.Get(_ItemID);
|
if (_MyItem == null && _ItemID != 0) _MyItem = Item.Get(_ItemID);
|
||||||
return _MyItem;
|
return _MyItem;
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CanWriteProperty("MyItem", true);
|
|
||||||
if (_MyItem != value)
|
if (_MyItem != value)
|
||||||
{
|
{
|
||||||
_MyItem = value;
|
_MyItem = value;
|
||||||
@ -99,13 +94,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("RtfText", true);
|
|
||||||
return _RtfText;
|
return _RtfText;
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CanWriteProperty("RtfText", true);
|
|
||||||
if (value == null) value = string.Empty;
|
if (value == null) value = string.Empty;
|
||||||
if (_RtfText != value)
|
if (_RtfText != value)
|
||||||
{
|
{
|
||||||
@ -120,13 +113,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("SearchText", true);
|
|
||||||
return _SearchText;
|
return _SearchText;
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CanWriteProperty("SearchText", true);
|
|
||||||
if (value == null) value = string.Empty;
|
if (value == null) value = string.Empty;
|
||||||
if (_SearchText != value)
|
if (_SearchText != value)
|
||||||
{
|
{
|
||||||
@ -141,13 +132,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("Config", true);
|
|
||||||
return _Config;
|
return _Config;
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CanWriteProperty("Config", true);
|
|
||||||
if (value == null) value = string.Empty;
|
if (value == null) value = string.Empty;
|
||||||
if (_Config != value)
|
if (_Config != value)
|
||||||
{
|
{
|
||||||
@ -162,13 +151,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("DTS", true);
|
|
||||||
return _DTS;
|
return _DTS;
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CanWriteProperty("DTS", true);
|
|
||||||
if (_DTS != value)
|
if (_DTS != value)
|
||||||
{
|
{
|
||||||
_DTS = value;
|
_DTS = value;
|
||||||
@ -182,13 +169,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("UserID", true);
|
|
||||||
return _UserID;
|
return _UserID;
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CanWriteProperty("UserID", true);
|
|
||||||
if (value == null) value = string.Empty;
|
if (value == null) value = string.Empty;
|
||||||
if (_UserID != value)
|
if (_UserID != value)
|
||||||
{
|
{
|
||||||
@ -204,7 +189,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("Item_PreviousID", true);
|
|
||||||
return _Item_PreviousID;
|
return _Item_PreviousID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -214,7 +198,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("Item_ContentID", true);
|
|
||||||
return _Item_ContentID;
|
return _Item_ContentID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -224,7 +207,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("Item_DTS", true);
|
|
||||||
return _Item_DTS;
|
return _Item_DTS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -234,7 +216,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("Item_UserID", true);
|
|
||||||
return _Item_UserID;
|
return _Item_UserID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("TypeID", true);
|
|
||||||
return _TypeID;
|
return _TypeID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -106,7 +105,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("Name", true);
|
|
||||||
return _Name;
|
return _Name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -116,7 +114,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("Config", true);
|
|
||||||
return _Config;
|
return _Config;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -126,7 +123,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("DTS", true);
|
|
||||||
return _DTS;
|
return _DTS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -136,7 +132,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("UserID", true);
|
|
||||||
return _UserID;
|
return _UserID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -149,7 +144,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("AnnotationTypeAnnotationCount", true);
|
|
||||||
if (_AnnotationTypeAnnotationCount < 0)
|
if (_AnnotationTypeAnnotationCount < 0)
|
||||||
_AnnotationTypeAnnotationCount = AnnotationTypeAnnotations.Count;
|
_AnnotationTypeAnnotationCount = AnnotationTypeAnnotations.Count;
|
||||||
return _AnnotationTypeAnnotationCount;
|
return _AnnotationTypeAnnotationCount;
|
||||||
@ -162,7 +156,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("AnnotationTypeAnnotations", true);
|
|
||||||
if (_AnnotationTypeAnnotationCount < 0 || (_AnnotationTypeAnnotationCount > 0 && _AnnotationTypeAnnotations == null))
|
if (_AnnotationTypeAnnotationCount < 0 || (_AnnotationTypeAnnotationCount > 0 && _AnnotationTypeAnnotations == null))
|
||||||
_AnnotationTypeAnnotations = AnnotationInfoList.GetByTypeID(_TypeID);
|
_AnnotationTypeAnnotations = AnnotationInfoList.GetByTypeID(_TypeID);
|
||||||
if (_AnnotationTypeAnnotationCount < 0)
|
if (_AnnotationTypeAnnotationCount < 0)
|
||||||
|
@ -109,7 +109,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("AID", true);
|
|
||||||
return _AID;
|
return _AID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -119,7 +118,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("GID", true);
|
|
||||||
if (_MyGroup != null) _GID = _MyGroup.GID;
|
if (_MyGroup != null) _GID = _MyGroup.GID;
|
||||||
return _GID;
|
return _GID;
|
||||||
}
|
}
|
||||||
@ -130,14 +128,12 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("MyGroup", true);
|
|
||||||
if (_MyGroup == null && _GID != 0) _MyGroup = Group.Get(_GID);
|
if (_MyGroup == null && _GID != 0) _MyGroup = Group.Get(_GID);
|
||||||
return _MyGroup;
|
return _MyGroup;
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CanWriteProperty("MyGroup", true);
|
|
||||||
if (_MyGroup != value)
|
if (_MyGroup != value)
|
||||||
{
|
{
|
||||||
_MyGroup = value;
|
_MyGroup = value;
|
||||||
@ -152,7 +148,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("RID", true);
|
|
||||||
if (_MyRole != null) _RID = _MyRole.RID;
|
if (_MyRole != null) _RID = _MyRole.RID;
|
||||||
return _RID;
|
return _RID;
|
||||||
}
|
}
|
||||||
@ -163,14 +158,12 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("MyRole", true);
|
|
||||||
if (_MyRole == null && _RID != 0) _MyRole = Role.Get(_RID);
|
if (_MyRole == null && _RID != 0) _MyRole = Role.Get(_RID);
|
||||||
return _MyRole;
|
return _MyRole;
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CanWriteProperty("MyRole", true);
|
|
||||||
if (_MyRole != value)
|
if (_MyRole != value)
|
||||||
{
|
{
|
||||||
_MyRole = value;
|
_MyRole = value;
|
||||||
@ -185,7 +178,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("FolderID", true);
|
|
||||||
if (_MyFolder != null) _FolderID = _MyFolder.FolderID;
|
if (_MyFolder != null) _FolderID = _MyFolder.FolderID;
|
||||||
return _FolderID;
|
return _FolderID;
|
||||||
}
|
}
|
||||||
@ -196,14 +188,12 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("MyFolder", true);
|
|
||||||
if (_MyFolder == null && _FolderID != 0) _MyFolder = Folder.Get(_FolderID);
|
if (_MyFolder == null && _FolderID != 0) _MyFolder = Folder.Get(_FolderID);
|
||||||
return _MyFolder;
|
return _MyFolder;
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CanWriteProperty("MyFolder", true);
|
|
||||||
if (_MyFolder != value)
|
if (_MyFolder != value)
|
||||||
{
|
{
|
||||||
_MyFolder = value;
|
_MyFolder = value;
|
||||||
@ -218,13 +208,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("StartDate", true);
|
|
||||||
return _StartDate;
|
return _StartDate;
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CanWriteProperty("StartDate", true);
|
|
||||||
if (value == null) value = string.Empty;
|
if (value == null) value = string.Empty;
|
||||||
_StartDate = value;
|
_StartDate = value;
|
||||||
try
|
try
|
||||||
@ -248,13 +236,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("EndDate", true);
|
|
||||||
return _EndDate;
|
return _EndDate;
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CanWriteProperty("EndDate", true);
|
|
||||||
if (value == null) value = string.Empty;
|
if (value == null) value = string.Empty;
|
||||||
_EndDate = value;
|
_EndDate = value;
|
||||||
try
|
try
|
||||||
@ -278,13 +264,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("DTS", true);
|
|
||||||
return _DTS;
|
return _DTS;
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CanWriteProperty("DTS", true);
|
|
||||||
if (_DTS != value)
|
if (_DTS != value)
|
||||||
{
|
{
|
||||||
_DTS = value;
|
_DTS = value;
|
||||||
@ -298,13 +282,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("UsrID", true);
|
|
||||||
return _UsrID;
|
return _UsrID;
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CanWriteProperty("UsrID", true);
|
|
||||||
if (value == null) value = string.Empty;
|
if (value == null) value = string.Empty;
|
||||||
if (_UsrID != value)
|
if (_UsrID != value)
|
||||||
{
|
{
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -19,432 +19,424 @@ using System.ComponentModel;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
public delegate void AssociationInfoEvent(object sender);
|
public delegate void AssociationInfoEvent(object sender);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// AssociationInfo Generated by MyGeneration using the CSLA Object Mapping template
|
/// AssociationInfo Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
[TypeConverter(typeof(AssociationInfoConverter))]
|
[TypeConverter(typeof(AssociationInfoConverter))]
|
||||||
public partial class AssociationInfo : ReadOnlyBase<AssociationInfo>, IDisposable
|
public partial class AssociationInfo : ReadOnlyBase<AssociationInfo>, IDisposable
|
||||||
{
|
{
|
||||||
public event AssociationInfoEvent Changed;
|
public event AssociationInfoEvent Changed;
|
||||||
private void OnChange()
|
private void OnChange()
|
||||||
{
|
{
|
||||||
if (Changed != null) Changed(this);
|
if (Changed != null) Changed(this);
|
||||||
}
|
}
|
||||||
#region Log4Net
|
#region Log4Net
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
private static List<AssociationInfo> _CacheList = new List<AssociationInfo>();
|
private static List<AssociationInfo> _CacheList = new List<AssociationInfo>();
|
||||||
protected static void AddToCache(AssociationInfo associationInfo)
|
protected static void AddToCache(AssociationInfo associationInfo)
|
||||||
{
|
{
|
||||||
if (!_CacheList.Contains(associationInfo)) _CacheList.Add(associationInfo); // In AddToCache
|
if (!_CacheList.Contains(associationInfo)) _CacheList.Add(associationInfo); // In AddToCache
|
||||||
}
|
}
|
||||||
protected static void RemoveFromCache(AssociationInfo associationInfo)
|
protected static void RemoveFromCache(AssociationInfo associationInfo)
|
||||||
{
|
{
|
||||||
while (_CacheList.Contains(associationInfo)) _CacheList.Remove(associationInfo); // In RemoveFromCache
|
while (_CacheList.Contains(associationInfo)) _CacheList.Remove(associationInfo); // In RemoveFromCache
|
||||||
}
|
}
|
||||||
private static Dictionary<string, List<AssociationInfo>> _CacheByPrimaryKey = new Dictionary<string, List<AssociationInfo>>();
|
private static Dictionary<string, List<AssociationInfo>> _CacheByPrimaryKey = new Dictionary<string, List<AssociationInfo>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
while (_CacheList.Count > 0) // Move AssociationInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
while (_CacheList.Count > 0) // Move AssociationInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
||||||
{
|
{
|
||||||
AssociationInfo tmp = _CacheList[0]; // Get the first AssociationInfo
|
AssociationInfo tmp = _CacheList[0]; // Get the first AssociationInfo
|
||||||
string pKey = tmp.AssociationID.ToString();
|
string pKey = tmp.AssociationID.ToString();
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
||||||
{
|
{
|
||||||
_CacheByPrimaryKey[pKey] = new List<AssociationInfo>(); // Add new list for PrimaryKey
|
_CacheByPrimaryKey[pKey] = new List<AssociationInfo>(); // Add new list for PrimaryKey
|
||||||
}
|
}
|
||||||
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
||||||
_CacheList.RemoveAt(0); // Remove the first AssociationInfo
|
_CacheList.RemoveAt(0); // Remove the first AssociationInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
internal static void AddList(AssociationInfoList lst)
|
internal static void AddList(AssociationInfoList lst)
|
||||||
{
|
{
|
||||||
foreach (AssociationInfo item in lst) AddToCache(item);
|
foreach (AssociationInfo item in lst) AddToCache(item);
|
||||||
}
|
}
|
||||||
protected static AssociationInfo GetCachedByPrimaryKey(int associationID)
|
protected static AssociationInfo GetCachedByPrimaryKey(int associationID)
|
||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = associationID.ToString();
|
string key = associationID.ToString();
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Business Methods
|
#region Business Methods
|
||||||
private string _ErrorMessage = string.Empty;
|
private string _ErrorMessage = string.Empty;
|
||||||
public string ErrorMessage
|
public string ErrorMessage
|
||||||
{
|
{
|
||||||
get { return _ErrorMessage; }
|
get { return _ErrorMessage; }
|
||||||
}
|
}
|
||||||
protected Association _Editable;
|
protected Association _Editable;
|
||||||
private IVEHasBrokenRules HasBrokenRules
|
private IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
IVEHasBrokenRules hasBrokenRules = null;
|
IVEHasBrokenRules hasBrokenRules = null;
|
||||||
if (_Editable != null)
|
if (_Editable != null)
|
||||||
hasBrokenRules = _Editable.HasBrokenRules;
|
hasBrokenRules = _Editable.HasBrokenRules;
|
||||||
return hasBrokenRules;
|
return hasBrokenRules;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private int _AssociationID;
|
private int _AssociationID;
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
public int AssociationID
|
public int AssociationID
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("AssociationID", true);
|
return _AssociationID;
|
||||||
return _AssociationID;
|
}
|
||||||
}
|
}
|
||||||
}
|
private int _VersionID;
|
||||||
private int _VersionID;
|
public int VersionID
|
||||||
public int VersionID
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
get
|
||||||
get
|
{
|
||||||
{
|
if (_MyDocVersion != null) _VersionID = _MyDocVersion.VersionID;
|
||||||
CanReadProperty("VersionID", true);
|
return _VersionID;
|
||||||
if (_MyDocVersion != null) _VersionID = _MyDocVersion.VersionID;
|
}
|
||||||
return _VersionID;
|
}
|
||||||
}
|
private DocVersionInfo _MyDocVersion;
|
||||||
}
|
public DocVersionInfo MyDocVersion
|
||||||
private DocVersionInfo _MyDocVersion;
|
{
|
||||||
public DocVersionInfo MyDocVersion
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
if (_MyDocVersion == null && _VersionID != 0) _MyDocVersion = DocVersionInfo.Get(_VersionID);
|
||||||
{
|
return _MyDocVersion;
|
||||||
CanReadProperty("MyDocVersion", true);
|
}
|
||||||
if (_MyDocVersion == null && _VersionID != 0) _MyDocVersion = DocVersionInfo.Get(_VersionID);
|
}
|
||||||
return _MyDocVersion;
|
private int _ROFstID;
|
||||||
}
|
public int ROFstID
|
||||||
}
|
{
|
||||||
private int _ROFstID;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
public int ROFstID
|
get
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
if (_MyROFst != null) _ROFstID = _MyROFst.ROFstID;
|
||||||
get
|
return _ROFstID;
|
||||||
{
|
}
|
||||||
CanReadProperty("ROFstID", true);
|
}
|
||||||
if (_MyROFst != null) _ROFstID = _MyROFst.ROFstID;
|
private ROFstInfo _MyROFst;
|
||||||
return _ROFstID;
|
public ROFstInfo MyROFst
|
||||||
}
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
private ROFstInfo _MyROFst;
|
get
|
||||||
public ROFstInfo MyROFst
|
{
|
||||||
{
|
//if (_MyROFst == null && _ROFstID != 0) _MyROFst = ROFstInfo.Get(_ROFstID);
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
if (_MyROFst == null && _ROFstID != 0) _MyROFst = ROFstInfo.GetJustROFst(_ROFstID);// Improve performance by not loading all ROImages
|
||||||
get
|
return _MyROFst;
|
||||||
{
|
}
|
||||||
CanReadProperty("MyROFst", true);
|
}
|
||||||
//if (_MyROFst == null && _ROFstID != 0) _MyROFst = ROFstInfo.Get(_ROFstID);
|
private string _Config = string.Empty;
|
||||||
if (_MyROFst == null && _ROFstID != 0) _MyROFst = ROFstInfo.GetJustROFst(_ROFstID);// Improve performance by not loading all ROImages
|
public string Config
|
||||||
return _MyROFst;
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
private string _Config = string.Empty;
|
{
|
||||||
public string Config
|
return _Config;
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
private DateTime _DTS = new DateTime();
|
||||||
{
|
public DateTime DTS
|
||||||
CanReadProperty("Config", true);
|
{
|
||||||
return _Config;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
}
|
{
|
||||||
private DateTime _DTS = new DateTime();
|
return _DTS;
|
||||||
public DateTime DTS
|
}
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
private string _UserID = string.Empty;
|
||||||
get
|
public string UserID
|
||||||
{
|
{
|
||||||
CanReadProperty("DTS", true);
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
return _DTS;
|
get
|
||||||
}
|
{
|
||||||
}
|
return _UserID;
|
||||||
private string _UserID = string.Empty;
|
}
|
||||||
public string UserID
|
}
|
||||||
{
|
// CSLATODO: Replace base AssociationInfo.ToString function as necessary
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
/// <summary>
|
||||||
get
|
/// Overrides Base ToString
|
||||||
{
|
/// </summary>
|
||||||
CanReadProperty("UserID", true);
|
/// <returns>A string representation of current AssociationInfo</returns>
|
||||||
return _UserID;
|
//public override string ToString()
|
||||||
}
|
//{
|
||||||
}
|
// return base.ToString();
|
||||||
// CSLATODO: Replace base AssociationInfo.ToString function as necessary
|
//}
|
||||||
/// <summary>
|
// CSLATODO: Check AssociationInfo.GetIdValue to assure that the ID returned is unique
|
||||||
/// Overrides Base ToString
|
/// <summary>
|
||||||
/// </summary>
|
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||||
/// <returns>A string representation of current AssociationInfo</returns>
|
/// </summary>
|
||||||
//public override string ToString()
|
/// <returns>A Unique ID for the current AssociationInfo</returns>
|
||||||
//{
|
protected override object GetIdValue()
|
||||||
// return base.ToString();
|
{
|
||||||
//}
|
return MyAssociationInfoUnique; // Absolutely Unique ID
|
||||||
// CSLATODO: Check AssociationInfo.GetIdValue to assure that the ID returned is unique
|
}
|
||||||
/// <summary>
|
#endregion
|
||||||
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
#region Factory Methods
|
||||||
/// </summary>
|
private static int _AssociationInfoUnique = 0;
|
||||||
/// <returns>A Unique ID for the current AssociationInfo</returns>
|
private static int AssociationInfoUnique
|
||||||
protected override object GetIdValue()
|
{ get { return ++_AssociationInfoUnique; } }
|
||||||
{
|
private int _MyAssociationInfoUnique = AssociationInfoUnique;
|
||||||
return MyAssociationInfoUnique; // Absolutely Unique ID
|
public int MyAssociationInfoUnique // Absolutely Unique ID - Info
|
||||||
}
|
{ get { return _MyAssociationInfoUnique; } }
|
||||||
#endregion
|
protected AssociationInfo()
|
||||||
#region Factory Methods
|
{/* require use of factory methods */
|
||||||
private static int _AssociationInfoUnique = 0;
|
AddToCache(this);
|
||||||
private static int AssociationInfoUnique
|
}
|
||||||
{ get { return ++_AssociationInfoUnique; } }
|
private bool _Disposed = false;
|
||||||
private int _MyAssociationInfoUnique = AssociationInfoUnique;
|
private static int _CountCreated = 0;
|
||||||
public int MyAssociationInfoUnique // Absolutely Unique ID - Info
|
private static int _CountDisposed = 0;
|
||||||
{ get { return _MyAssociationInfoUnique; } }
|
private static int _CountFinalized = 0;
|
||||||
protected AssociationInfo()
|
private static int IncrementCountCreated
|
||||||
{/* require use of factory methods */
|
{ get { return ++_CountCreated; } }
|
||||||
AddToCache(this);
|
private int _CountWhenCreated = IncrementCountCreated;
|
||||||
}
|
public static int CountCreated
|
||||||
private bool _Disposed = false;
|
{ get { return _CountCreated; } }
|
||||||
private static int _CountCreated = 0;
|
public static int CountNotDisposed
|
||||||
private static int _CountDisposed = 0;
|
{ get { return _CountCreated - _CountDisposed; } }
|
||||||
private static int _CountFinalized = 0;
|
public static int CountNotFinalized
|
||||||
private static int IncrementCountCreated
|
{ get { return _CountCreated - _CountFinalized; } }
|
||||||
{ get { return ++_CountCreated; } }
|
~AssociationInfo()
|
||||||
private int _CountWhenCreated = IncrementCountCreated;
|
{
|
||||||
public static int CountCreated
|
_CountFinalized++;
|
||||||
{ get { return _CountCreated; } }
|
}
|
||||||
public static int CountNotDisposed
|
public void Dispose()
|
||||||
{ get { return _CountCreated - _CountDisposed; } }
|
{
|
||||||
public static int CountNotFinalized
|
if (_Disposed) return;
|
||||||
{ get { return _CountCreated - _CountFinalized; } }
|
_CountDisposed++;
|
||||||
~AssociationInfo()
|
_Disposed = true;
|
||||||
{
|
RemoveFromCache(this);
|
||||||
_CountFinalized++;
|
if (!_CacheByPrimaryKey.ContainsKey(AssociationID.ToString())) return;
|
||||||
}
|
List<AssociationInfo> listAssociationInfo = _CacheByPrimaryKey[AssociationID.ToString()]; // Get the list of items
|
||||||
public void Dispose()
|
while (listAssociationInfo.Contains(this)) listAssociationInfo.Remove(this); // Remove the item from the list
|
||||||
{
|
if (listAssociationInfo.Count == 0) // If there are no items left in the list
|
||||||
if (_Disposed) return;
|
_CacheByPrimaryKey.Remove(AssociationID.ToString()); // remove the list
|
||||||
_CountDisposed++;
|
}
|
||||||
_Disposed = true;
|
public virtual Association Get()
|
||||||
RemoveFromCache(this);
|
{
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(AssociationID.ToString())) return;
|
return _Editable = Association.Get(_AssociationID);
|
||||||
List<AssociationInfo> listAssociationInfo = _CacheByPrimaryKey[AssociationID.ToString()]; // Get the list of items
|
}
|
||||||
while (listAssociationInfo.Contains(this)) listAssociationInfo.Remove(this); // Remove the item from the list
|
public static void Refresh(Association tmp)
|
||||||
if (listAssociationInfo.Count == 0) // If there are no items left in the list
|
{
|
||||||
_CacheByPrimaryKey.Remove(AssociationID.ToString()); // remove the list
|
string key = tmp.AssociationID.ToString();
|
||||||
}
|
ConvertListToDictionary();
|
||||||
public virtual Association Get()
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
{
|
foreach (AssociationInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
return _Editable = Association.Get(_AssociationID);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
public static void Refresh(Association tmp)
|
protected virtual void RefreshFields(Association tmp)
|
||||||
{
|
{
|
||||||
string key = tmp.AssociationID.ToString();
|
if (_VersionID != tmp.VersionID)
|
||||||
ConvertListToDictionary();
|
{
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
if (MyDocVersion != null) MyDocVersion.RefreshDocVersionAssociations(); // Update List for old value
|
||||||
foreach (AssociationInfo tmpInfo in _CacheByPrimaryKey[key])
|
_VersionID = tmp.VersionID; // Update the value
|
||||||
tmpInfo.RefreshFields(tmp);
|
}
|
||||||
}
|
_MyDocVersion = null; // Reset list so that the next line gets a new list
|
||||||
protected virtual void RefreshFields(Association tmp)
|
if (MyDocVersion != null) MyDocVersion.RefreshDocVersionAssociations(); // Update List for new value
|
||||||
{
|
if (_ROFstID != tmp.ROFstID)
|
||||||
if (_VersionID != tmp.VersionID)
|
{
|
||||||
{
|
if (MyROFst != null) MyROFst.RefreshROFstAssociations(); // Update List for old value
|
||||||
if (MyDocVersion != null) MyDocVersion.RefreshDocVersionAssociations(); // Update List for old value
|
_ROFstID = tmp.ROFstID; // Update the value
|
||||||
_VersionID = tmp.VersionID; // Update the value
|
}
|
||||||
}
|
_MyROFst = null; // Reset list so that the next line gets a new list
|
||||||
_MyDocVersion = null; // Reset list so that the next line gets a new list
|
if (MyROFst != null) MyROFst.RefreshROFstAssociations(); // Update List for new value
|
||||||
if (MyDocVersion != null) MyDocVersion.RefreshDocVersionAssociations(); // Update List for new value
|
_Config = tmp.Config;
|
||||||
if (_ROFstID != tmp.ROFstID)
|
_DTS = tmp.DTS;
|
||||||
{
|
_UserID = tmp.UserID;
|
||||||
if (MyROFst != null) MyROFst.RefreshROFstAssociations(); // Update List for old value
|
_AssociationInfoExtension.Refresh(this);
|
||||||
_ROFstID = tmp.ROFstID; // Update the value
|
OnChange();// raise an event
|
||||||
}
|
}
|
||||||
_MyROFst = null; // Reset list so that the next line gets a new list
|
public static void Refresh(DocVersionAssociation tmp)
|
||||||
if (MyROFst != null) MyROFst.RefreshROFstAssociations(); // Update List for new value
|
{
|
||||||
_Config = tmp.Config;
|
string key = tmp.AssociationID.ToString();
|
||||||
_DTS = tmp.DTS;
|
ConvertListToDictionary();
|
||||||
_UserID = tmp.UserID;
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
_AssociationInfoExtension.Refresh(this);
|
foreach (AssociationInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
OnChange();// raise an event
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
public static void Refresh(DocVersionAssociation tmp)
|
protected virtual void RefreshFields(DocVersionAssociation tmp)
|
||||||
{
|
{
|
||||||
string key = tmp.AssociationID.ToString();
|
if (_ROFstID != tmp.ROFstID)
|
||||||
ConvertListToDictionary();
|
{
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
if (MyROFst != null) MyROFst.RefreshROFstAssociations(); // Update List for old value
|
||||||
foreach (AssociationInfo tmpInfo in _CacheByPrimaryKey[key])
|
_ROFstID = tmp.ROFstID; // Update the value
|
||||||
tmpInfo.RefreshFields(tmp);
|
}
|
||||||
}
|
_MyROFst = null; // Reset list so that the next line gets a new list
|
||||||
protected virtual void RefreshFields(DocVersionAssociation tmp)
|
if (MyROFst != null) MyROFst.RefreshROFstAssociations(); // Update List for new value
|
||||||
{
|
_Config = tmp.Config;
|
||||||
if (_ROFstID != tmp.ROFstID)
|
_DTS = tmp.DTS;
|
||||||
{
|
_UserID = tmp.UserID;
|
||||||
if (MyROFst != null) MyROFst.RefreshROFstAssociations(); // Update List for old value
|
_AssociationInfoExtension.Refresh(this);
|
||||||
_ROFstID = tmp.ROFstID; // Update the value
|
OnChange();// raise an event
|
||||||
}
|
}
|
||||||
_MyROFst = null; // Reset list so that the next line gets a new list
|
public static void Refresh(ROFstAssociation tmp)
|
||||||
if (MyROFst != null) MyROFst.RefreshROFstAssociations(); // Update List for new value
|
{
|
||||||
_Config = tmp.Config;
|
string key = tmp.AssociationID.ToString();
|
||||||
_DTS = tmp.DTS;
|
ConvertListToDictionary();
|
||||||
_UserID = tmp.UserID;
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
_AssociationInfoExtension.Refresh(this);
|
foreach (AssociationInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
OnChange();// raise an event
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
public static void Refresh(ROFstAssociation tmp)
|
protected virtual void RefreshFields(ROFstAssociation tmp)
|
||||||
{
|
{
|
||||||
string key = tmp.AssociationID.ToString();
|
if (_VersionID != tmp.VersionID)
|
||||||
ConvertListToDictionary();
|
{
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
if (MyDocVersion != null) MyDocVersion.RefreshDocVersionAssociations(); // Update List for old value
|
||||||
foreach (AssociationInfo tmpInfo in _CacheByPrimaryKey[key])
|
_VersionID = tmp.VersionID; // Update the value
|
||||||
tmpInfo.RefreshFields(tmp);
|
}
|
||||||
}
|
_MyDocVersion = null; // Reset list so that the next line gets a new list
|
||||||
protected virtual void RefreshFields(ROFstAssociation tmp)
|
if (MyDocVersion != null) MyDocVersion.RefreshDocVersionAssociations(); // Update List for new value
|
||||||
{
|
_Config = tmp.Config;
|
||||||
if (_VersionID != tmp.VersionID)
|
_DTS = tmp.DTS;
|
||||||
{
|
_UserID = tmp.UserID;
|
||||||
if (MyDocVersion != null) MyDocVersion.RefreshDocVersionAssociations(); // Update List for old value
|
_AssociationInfoExtension.Refresh(this);
|
||||||
_VersionID = tmp.VersionID; // Update the value
|
OnChange();// raise an event
|
||||||
}
|
}
|
||||||
_MyDocVersion = null; // Reset list so that the next line gets a new list
|
public static AssociationInfo Get(int associationID)
|
||||||
if (MyDocVersion != null) MyDocVersion.RefreshDocVersionAssociations(); // Update List for new value
|
{
|
||||||
_Config = tmp.Config;
|
//if (!CanGetObject())
|
||||||
_DTS = tmp.DTS;
|
// throw new System.Security.SecurityException("User not authorized to view a Association");
|
||||||
_UserID = tmp.UserID;
|
try
|
||||||
_AssociationInfoExtension.Refresh(this);
|
{
|
||||||
OnChange();// raise an event
|
AssociationInfo tmp = GetCachedByPrimaryKey(associationID);
|
||||||
}
|
if (tmp == null)
|
||||||
public static AssociationInfo Get(int associationID)
|
{
|
||||||
{
|
tmp = DataPortal.Fetch<AssociationInfo>(new PKCriteria(associationID));
|
||||||
//if (!CanGetObject())
|
AddToCache(tmp);
|
||||||
// throw new System.Security.SecurityException("User not authorized to view a Association");
|
}
|
||||||
try
|
if (tmp.ErrorMessage == "No Record Found")
|
||||||
{
|
{
|
||||||
AssociationInfo tmp = GetCachedByPrimaryKey(associationID);
|
tmp.Dispose(); // Clean-up AssociationInfo
|
||||||
if (tmp == null)
|
tmp = null;
|
||||||
{
|
}
|
||||||
tmp = DataPortal.Fetch<AssociationInfo>(new PKCriteria(associationID));
|
return tmp;
|
||||||
AddToCache(tmp);
|
}
|
||||||
}
|
catch (Exception ex)
|
||||||
if (tmp.ErrorMessage == "No Record Found")
|
{
|
||||||
{
|
throw new DbCslaException("Error on AssociationInfo.Get", ex);
|
||||||
tmp.Dispose(); // Clean-up AssociationInfo
|
}
|
||||||
tmp = null;
|
}
|
||||||
}
|
#endregion
|
||||||
return tmp;
|
#region Data Access Portal
|
||||||
}
|
internal AssociationInfo(SafeDataReader dr)
|
||||||
catch (Exception ex)
|
{
|
||||||
{
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AssociationInfo.Constructor", GetHashCode());
|
||||||
throw new DbCslaException("Error on AssociationInfo.Get", ex);
|
try
|
||||||
}
|
{
|
||||||
}
|
ReadData(dr);
|
||||||
#endregion
|
}
|
||||||
#region Data Access Portal
|
catch (Exception ex)
|
||||||
internal AssociationInfo(SafeDataReader dr)
|
{
|
||||||
{
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("AssociationInfo.Constructor", ex);
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AssociationInfo.Constructor", GetHashCode());
|
throw new DbCslaException("AssociationInfo.Constructor", ex);
|
||||||
try
|
}
|
||||||
{
|
}
|
||||||
ReadData(dr);
|
[Serializable()]
|
||||||
}
|
protected class PKCriteria
|
||||||
catch (Exception ex)
|
{
|
||||||
{
|
private int _AssociationID;
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AssociationInfo.Constructor", ex);
|
public int AssociationID
|
||||||
throw new DbCslaException("AssociationInfo.Constructor", ex);
|
{ get { return _AssociationID; } }
|
||||||
}
|
public PKCriteria(int associationID)
|
||||||
}
|
{
|
||||||
[Serializable()]
|
_AssociationID = associationID;
|
||||||
protected class PKCriteria
|
}
|
||||||
{
|
}
|
||||||
private int _AssociationID;
|
private void ReadData(SafeDataReader dr)
|
||||||
public int AssociationID
|
{
|
||||||
{ get { return _AssociationID; } }
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AssociationInfo.ReadData", GetHashCode());
|
||||||
public PKCriteria(int associationID)
|
try
|
||||||
{
|
{
|
||||||
_AssociationID = associationID;
|
_AssociationID = dr.GetInt32("AssociationID");
|
||||||
}
|
_VersionID = dr.GetInt32("VersionID");
|
||||||
}
|
_ROFstID = dr.GetInt32("ROFstID");
|
||||||
private void ReadData(SafeDataReader dr)
|
_Config = dr.GetString("Config");
|
||||||
{
|
_DTS = dr.GetDateTime("DTS");
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AssociationInfo.ReadData", GetHashCode());
|
_UserID = dr.GetString("UserID");
|
||||||
try
|
}
|
||||||
{
|
catch (Exception ex)
|
||||||
_AssociationID = dr.GetInt32("AssociationID");
|
{
|
||||||
_VersionID = dr.GetInt32("VersionID");
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("AssociationInfo.ReadData", ex);
|
||||||
_ROFstID = dr.GetInt32("ROFstID");
|
_ErrorMessage = ex.Message;
|
||||||
_Config = dr.GetString("Config");
|
throw new DbCslaException("AssociationInfo.ReadData", ex);
|
||||||
_DTS = dr.GetDateTime("DTS");
|
}
|
||||||
_UserID = dr.GetString("UserID");
|
}
|
||||||
}
|
private void DataPortal_Fetch(PKCriteria criteria)
|
||||||
catch (Exception ex)
|
{
|
||||||
{
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AssociationInfo.DataPortal_Fetch", GetHashCode());
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AssociationInfo.ReadData", ex);
|
try
|
||||||
_ErrorMessage = ex.Message;
|
{
|
||||||
throw new DbCslaException("AssociationInfo.ReadData", ex);
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
}
|
{
|
||||||
}
|
ApplicationContext.LocalContext["cn"] = cn;
|
||||||
private void DataPortal_Fetch(PKCriteria criteria)
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
{
|
{
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AssociationInfo.DataPortal_Fetch", GetHashCode());
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
try
|
cm.CommandText = "getAssociation";
|
||||||
{
|
cm.Parameters.AddWithValue("@AssociationID", criteria.AssociationID);
|
||||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
{
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
ApplicationContext.LocalContext["cn"] = cn;
|
{
|
||||||
using (SqlCommand cm = cn.CreateCommand())
|
if (!dr.Read())
|
||||||
{
|
{
|
||||||
cm.CommandType = CommandType.StoredProcedure;
|
_ErrorMessage = "No Record Found";
|
||||||
cm.CommandText = "getAssociation";
|
return;
|
||||||
cm.Parameters.AddWithValue("@AssociationID", criteria.AssociationID);
|
}
|
||||||
cm.CommandTimeout = Database.DefaultTimeout;
|
ReadData(dr);
|
||||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
}
|
||||||
{
|
}
|
||||||
if (!dr.Read())
|
// removing of item only needed for local data portal
|
||||||
{
|
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
||||||
_ErrorMessage = "No Record Found";
|
ApplicationContext.LocalContext.Remove("cn");
|
||||||
return;
|
}
|
||||||
}
|
}
|
||||||
ReadData(dr);
|
catch (Exception ex)
|
||||||
}
|
{
|
||||||
}
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("AssociationInfo.DataPortal_Fetch", ex);
|
||||||
// removing of item only needed for local data portal
|
_ErrorMessage = ex.Message;
|
||||||
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
throw new DbCslaException("AssociationInfo.DataPortal_Fetch", ex);
|
||||||
ApplicationContext.LocalContext.Remove("cn");
|
}
|
||||||
}
|
}
|
||||||
}
|
#endregion
|
||||||
catch (Exception ex)
|
// Standard Refresh
|
||||||
{
|
#region extension
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AssociationInfo.DataPortal_Fetch", ex);
|
AssociationInfoExtension _AssociationInfoExtension = new AssociationInfoExtension();
|
||||||
_ErrorMessage = ex.Message;
|
[Serializable()]
|
||||||
throw new DbCslaException("AssociationInfo.DataPortal_Fetch", ex);
|
partial class AssociationInfoExtension : extensionBase { }
|
||||||
}
|
[Serializable()]
|
||||||
}
|
class extensionBase
|
||||||
#endregion
|
{
|
||||||
// Standard Refresh
|
// Default Refresh
|
||||||
#region extension
|
public virtual void Refresh(AssociationInfo tmp) { }
|
||||||
AssociationInfoExtension _AssociationInfoExtension = new AssociationInfoExtension();
|
}
|
||||||
[Serializable()]
|
#endregion
|
||||||
partial class AssociationInfoExtension : extensionBase { }
|
} // Class
|
||||||
[Serializable()]
|
#region Converter
|
||||||
class extensionBase
|
internal class AssociationInfoConverter : ExpandableObjectConverter
|
||||||
{
|
{
|
||||||
// Default Refresh
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
public virtual void Refresh(AssociationInfo tmp) { }
|
{
|
||||||
}
|
if (destType == typeof(string) && value is AssociationInfo)
|
||||||
#endregion
|
{
|
||||||
} // Class
|
// Return the ToString value
|
||||||
#region Converter
|
return ((AssociationInfo)value).ToString();
|
||||||
internal class AssociationInfoConverter : ExpandableObjectConverter
|
}
|
||||||
{
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
}
|
||||||
{
|
}
|
||||||
if (destType == typeof(string) && value is AssociationInfo)
|
#endregion
|
||||||
{
|
|
||||||
// Return the ToString value
|
|
||||||
return ((AssociationInfo)value).ToString();
|
|
||||||
}
|
|
||||||
return base.ConvertTo(context, culture, value, destType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -19,431 +19,423 @@ using System.ComponentModel;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
public delegate void CheckInfoEvent(object sender);
|
public delegate void CheckInfoEvent(object sender);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// CheckInfo Generated by MyGeneration using the CSLA Object Mapping template
|
/// CheckInfo Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
[TypeConverter(typeof(CheckInfoConverter))]
|
[TypeConverter(typeof(CheckInfoConverter))]
|
||||||
public partial class CheckInfo : ReadOnlyBase<CheckInfo>, IDisposable
|
public partial class CheckInfo : ReadOnlyBase<CheckInfo>, IDisposable
|
||||||
{
|
{
|
||||||
public event CheckInfoEvent Changed;
|
public event CheckInfoEvent Changed;
|
||||||
private void OnChange()
|
private void OnChange()
|
||||||
{
|
{
|
||||||
if (Changed != null) Changed(this);
|
if (Changed != null) Changed(this);
|
||||||
}
|
}
|
||||||
#region Log4Net
|
#region Log4Net
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
private static List<CheckInfo> _CacheList = new List<CheckInfo>();
|
private static List<CheckInfo> _CacheList = new List<CheckInfo>();
|
||||||
protected static void AddToCache(CheckInfo checkInfo)
|
protected static void AddToCache(CheckInfo checkInfo)
|
||||||
{
|
{
|
||||||
if (!_CacheList.Contains(checkInfo)) _CacheList.Add(checkInfo); // In AddToCache
|
if (!_CacheList.Contains(checkInfo)) _CacheList.Add(checkInfo); // In AddToCache
|
||||||
}
|
}
|
||||||
protected static void RemoveFromCache(CheckInfo checkInfo)
|
protected static void RemoveFromCache(CheckInfo checkInfo)
|
||||||
{
|
{
|
||||||
while (_CacheList.Contains(checkInfo)) _CacheList.Remove(checkInfo); // In RemoveFromCache
|
while (_CacheList.Contains(checkInfo)) _CacheList.Remove(checkInfo); // In RemoveFromCache
|
||||||
}
|
}
|
||||||
private static Dictionary<string, List<CheckInfo>> _CacheByPrimaryKey = new Dictionary<string, List<CheckInfo>>();
|
private static Dictionary<string, List<CheckInfo>> _CacheByPrimaryKey = new Dictionary<string, List<CheckInfo>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
while (_CacheList.Count > 0) // Move CheckInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
while (_CacheList.Count > 0) // Move CheckInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
||||||
{
|
{
|
||||||
CheckInfo tmp = _CacheList[0]; // Get the first CheckInfo
|
CheckInfo tmp = _CacheList[0]; // Get the first CheckInfo
|
||||||
string pKey = tmp.CheckID.ToString();
|
string pKey = tmp.CheckID.ToString();
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
||||||
{
|
{
|
||||||
_CacheByPrimaryKey[pKey] = new List<CheckInfo>(); // Add new list for PrimaryKey
|
_CacheByPrimaryKey[pKey] = new List<CheckInfo>(); // Add new list for PrimaryKey
|
||||||
}
|
}
|
||||||
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
||||||
_CacheList.RemoveAt(0); // Remove the first CheckInfo
|
_CacheList.RemoveAt(0); // Remove the first CheckInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
internal static void AddList(CheckInfoList lst)
|
internal static void AddList(CheckInfoList lst)
|
||||||
{
|
{
|
||||||
foreach (CheckInfo item in lst) AddToCache(item);
|
foreach (CheckInfo item in lst) AddToCache(item);
|
||||||
}
|
}
|
||||||
protected static CheckInfo GetCachedByPrimaryKey(int checkID)
|
protected static CheckInfo GetCachedByPrimaryKey(int checkID)
|
||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = checkID.ToString();
|
string key = checkID.ToString();
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Business Methods
|
#region Business Methods
|
||||||
private string _ErrorMessage = string.Empty;
|
private string _ErrorMessage = string.Empty;
|
||||||
public string ErrorMessage
|
public string ErrorMessage
|
||||||
{
|
{
|
||||||
get { return _ErrorMessage; }
|
get { return _ErrorMessage; }
|
||||||
}
|
}
|
||||||
protected Check _Editable;
|
protected Check _Editable;
|
||||||
private IVEHasBrokenRules HasBrokenRules
|
private IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
IVEHasBrokenRules hasBrokenRules = null;
|
IVEHasBrokenRules hasBrokenRules = null;
|
||||||
if (_Editable != null)
|
if (_Editable != null)
|
||||||
hasBrokenRules = _Editable.HasBrokenRules;
|
hasBrokenRules = _Editable.HasBrokenRules;
|
||||||
return hasBrokenRules;
|
return hasBrokenRules;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private int _CheckID;
|
private int _CheckID;
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
public int CheckID
|
public int CheckID
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("CheckID", true);
|
return _CheckID;
|
||||||
return _CheckID;
|
}
|
||||||
}
|
}
|
||||||
}
|
private int _RevisionID;
|
||||||
private int _RevisionID;
|
public int RevisionID
|
||||||
public int RevisionID
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
get
|
||||||
get
|
{
|
||||||
{
|
if (_MyRevision != null) _RevisionID = _MyRevision.RevisionID;
|
||||||
CanReadProperty("RevisionID", true);
|
return _RevisionID;
|
||||||
if (_MyRevision != null) _RevisionID = _MyRevision.RevisionID;
|
}
|
||||||
return _RevisionID;
|
}
|
||||||
}
|
private RevisionInfo _MyRevision;
|
||||||
}
|
public RevisionInfo MyRevision
|
||||||
private RevisionInfo _MyRevision;
|
{
|
||||||
public RevisionInfo MyRevision
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
if (_MyRevision == null && _RevisionID != 0) _MyRevision = RevisionInfo.Get(_RevisionID);
|
||||||
{
|
return _MyRevision;
|
||||||
CanReadProperty("MyRevision", true);
|
}
|
||||||
if (_MyRevision == null && _RevisionID != 0) _MyRevision = RevisionInfo.Get(_RevisionID);
|
}
|
||||||
return _MyRevision;
|
private int _StageID;
|
||||||
}
|
public int StageID
|
||||||
}
|
{
|
||||||
private int _StageID;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
public int StageID
|
get
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
if (_MyStage != null) _StageID = _MyStage.StageID;
|
||||||
get
|
return _StageID;
|
||||||
{
|
}
|
||||||
CanReadProperty("StageID", true);
|
}
|
||||||
if (_MyStage != null) _StageID = _MyStage.StageID;
|
private StageInfo _MyStage;
|
||||||
return _StageID;
|
public StageInfo MyStage
|
||||||
}
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
private StageInfo _MyStage;
|
get
|
||||||
public StageInfo MyStage
|
{
|
||||||
{
|
if (_MyStage == null && _StageID != 0) _MyStage = StageInfo.GetJustStage(_StageID);
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
return _MyStage;
|
||||||
get
|
}
|
||||||
{
|
}
|
||||||
CanReadProperty("MyStage", true);
|
private string _ConsistencyChecks = string.Empty;
|
||||||
if (_MyStage == null && _StageID != 0) _MyStage = StageInfo.GetJustStage(_StageID);
|
public string ConsistencyChecks
|
||||||
return _MyStage;
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
private string _ConsistencyChecks = string.Empty;
|
{
|
||||||
public string ConsistencyChecks
|
return _ConsistencyChecks;
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
private DateTime _DTS = new DateTime();
|
||||||
{
|
public DateTime DTS
|
||||||
CanReadProperty("ConsistencyChecks", true);
|
{
|
||||||
return _ConsistencyChecks;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
}
|
{
|
||||||
private DateTime _DTS = new DateTime();
|
return _DTS;
|
||||||
public DateTime DTS
|
}
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
private string _UserID = string.Empty;
|
||||||
get
|
public string UserID
|
||||||
{
|
{
|
||||||
CanReadProperty("DTS", true);
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
return _DTS;
|
get
|
||||||
}
|
{
|
||||||
}
|
return _UserID;
|
||||||
private string _UserID = string.Empty;
|
}
|
||||||
public string UserID
|
}
|
||||||
{
|
// CSLATODO: Replace base CheckInfo.ToString function as necessary
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
/// <summary>
|
||||||
get
|
/// Overrides Base ToString
|
||||||
{
|
/// </summary>
|
||||||
CanReadProperty("UserID", true);
|
/// <returns>A string representation of current CheckInfo</returns>
|
||||||
return _UserID;
|
//public override string ToString()
|
||||||
}
|
//{
|
||||||
}
|
// return base.ToString();
|
||||||
// CSLATODO: Replace base CheckInfo.ToString function as necessary
|
//}
|
||||||
/// <summary>
|
// CSLATODO: Check CheckInfo.GetIdValue to assure that the ID returned is unique
|
||||||
/// Overrides Base ToString
|
/// <summary>
|
||||||
/// </summary>
|
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||||
/// <returns>A string representation of current CheckInfo</returns>
|
/// </summary>
|
||||||
//public override string ToString()
|
/// <returns>A Unique ID for the current CheckInfo</returns>
|
||||||
//{
|
protected override object GetIdValue()
|
||||||
// return base.ToString();
|
{
|
||||||
//}
|
return MyCheckInfoUnique; // Absolutely Unique ID
|
||||||
// CSLATODO: Check CheckInfo.GetIdValue to assure that the ID returned is unique
|
}
|
||||||
/// <summary>
|
#endregion
|
||||||
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
#region Factory Methods
|
||||||
/// </summary>
|
private static int _CheckInfoUnique = 0;
|
||||||
/// <returns>A Unique ID for the current CheckInfo</returns>
|
private static int CheckInfoUnique
|
||||||
protected override object GetIdValue()
|
{ get { return ++_CheckInfoUnique; } }
|
||||||
{
|
private int _MyCheckInfoUnique = CheckInfoUnique;
|
||||||
return MyCheckInfoUnique; // Absolutely Unique ID
|
public int MyCheckInfoUnique // Absolutely Unique ID - Info
|
||||||
}
|
{ get { return _MyCheckInfoUnique; } }
|
||||||
#endregion
|
protected CheckInfo()
|
||||||
#region Factory Methods
|
{/* require use of factory methods */
|
||||||
private static int _CheckInfoUnique = 0;
|
AddToCache(this);
|
||||||
private static int CheckInfoUnique
|
}
|
||||||
{ get { return ++_CheckInfoUnique; } }
|
private bool _Disposed = false;
|
||||||
private int _MyCheckInfoUnique = CheckInfoUnique;
|
private static int _CountCreated = 0;
|
||||||
public int MyCheckInfoUnique // Absolutely Unique ID - Info
|
private static int _CountDisposed = 0;
|
||||||
{ get { return _MyCheckInfoUnique; } }
|
private static int _CountFinalized = 0;
|
||||||
protected CheckInfo()
|
private static int IncrementCountCreated
|
||||||
{/* require use of factory methods */
|
{ get { return ++_CountCreated; } }
|
||||||
AddToCache(this);
|
private int _CountWhenCreated = IncrementCountCreated;
|
||||||
}
|
public static int CountCreated
|
||||||
private bool _Disposed = false;
|
{ get { return _CountCreated; } }
|
||||||
private static int _CountCreated = 0;
|
public static int CountNotDisposed
|
||||||
private static int _CountDisposed = 0;
|
{ get { return _CountCreated - _CountDisposed; } }
|
||||||
private static int _CountFinalized = 0;
|
public static int CountNotFinalized
|
||||||
private static int IncrementCountCreated
|
{ get { return _CountCreated - _CountFinalized; } }
|
||||||
{ get { return ++_CountCreated; } }
|
~CheckInfo()
|
||||||
private int _CountWhenCreated = IncrementCountCreated;
|
{
|
||||||
public static int CountCreated
|
_CountFinalized++;
|
||||||
{ get { return _CountCreated; } }
|
}
|
||||||
public static int CountNotDisposed
|
public void Dispose()
|
||||||
{ get { return _CountCreated - _CountDisposed; } }
|
{
|
||||||
public static int CountNotFinalized
|
if (_Disposed) return;
|
||||||
{ get { return _CountCreated - _CountFinalized; } }
|
_CountDisposed++;
|
||||||
~CheckInfo()
|
_Disposed = true;
|
||||||
{
|
RemoveFromCache(this);
|
||||||
_CountFinalized++;
|
if (!_CacheByPrimaryKey.ContainsKey(CheckID.ToString())) return;
|
||||||
}
|
List<CheckInfo> listCheckInfo = _CacheByPrimaryKey[CheckID.ToString()]; // Get the list of items
|
||||||
public void Dispose()
|
while (listCheckInfo.Contains(this)) listCheckInfo.Remove(this); // Remove the item from the list
|
||||||
{
|
if (listCheckInfo.Count == 0) // If there are no items left in the list
|
||||||
if (_Disposed) return;
|
_CacheByPrimaryKey.Remove(CheckID.ToString()); // remove the list
|
||||||
_CountDisposed++;
|
}
|
||||||
_Disposed = true;
|
public virtual Check Get()
|
||||||
RemoveFromCache(this);
|
{
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(CheckID.ToString())) return;
|
return _Editable = Check.Get(_CheckID);
|
||||||
List<CheckInfo> listCheckInfo = _CacheByPrimaryKey[CheckID.ToString()]; // Get the list of items
|
}
|
||||||
while (listCheckInfo.Contains(this)) listCheckInfo.Remove(this); // Remove the item from the list
|
public static void Refresh(Check tmp)
|
||||||
if (listCheckInfo.Count == 0) // If there are no items left in the list
|
{
|
||||||
_CacheByPrimaryKey.Remove(CheckID.ToString()); // remove the list
|
string key = tmp.CheckID.ToString();
|
||||||
}
|
ConvertListToDictionary();
|
||||||
public virtual Check Get()
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
{
|
foreach (CheckInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
return _Editable = Check.Get(_CheckID);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
public static void Refresh(Check tmp)
|
protected virtual void RefreshFields(Check tmp)
|
||||||
{
|
{
|
||||||
string key = tmp.CheckID.ToString();
|
if (_RevisionID != tmp.RevisionID)
|
||||||
ConvertListToDictionary();
|
{
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
if (MyRevision != null) MyRevision.RefreshRevisionChecks(); // Update List for old value
|
||||||
foreach (CheckInfo tmpInfo in _CacheByPrimaryKey[key])
|
_RevisionID = tmp.RevisionID; // Update the value
|
||||||
tmpInfo.RefreshFields(tmp);
|
}
|
||||||
}
|
_MyRevision = null; // Reset list so that the next line gets a new list
|
||||||
protected virtual void RefreshFields(Check tmp)
|
if (MyRevision != null) MyRevision.RefreshRevisionChecks(); // Update List for new value
|
||||||
{
|
if (_StageID != tmp.StageID)
|
||||||
if (_RevisionID != tmp.RevisionID)
|
{
|
||||||
{
|
if (MyStage != null) MyStage.RefreshStageChecks(); // Update List for old value
|
||||||
if (MyRevision != null) MyRevision.RefreshRevisionChecks(); // Update List for old value
|
_StageID = tmp.StageID; // Update the value
|
||||||
_RevisionID = tmp.RevisionID; // Update the value
|
}
|
||||||
}
|
_MyStage = null; // Reset list so that the next line gets a new list
|
||||||
_MyRevision = null; // Reset list so that the next line gets a new list
|
if (MyStage != null) MyStage.RefreshStageChecks(); // Update List for new value
|
||||||
if (MyRevision != null) MyRevision.RefreshRevisionChecks(); // Update List for new value
|
_ConsistencyChecks = tmp.ConsistencyChecks;
|
||||||
if (_StageID != tmp.StageID)
|
_DTS = tmp.DTS;
|
||||||
{
|
_UserID = tmp.UserID;
|
||||||
if (MyStage != null) MyStage.RefreshStageChecks(); // Update List for old value
|
_CheckInfoExtension.Refresh(this);
|
||||||
_StageID = tmp.StageID; // Update the value
|
OnChange();// raise an event
|
||||||
}
|
}
|
||||||
_MyStage = null; // Reset list so that the next line gets a new list
|
public static void Refresh(RevisionCheck tmp)
|
||||||
if (MyStage != null) MyStage.RefreshStageChecks(); // Update List for new value
|
{
|
||||||
_ConsistencyChecks = tmp.ConsistencyChecks;
|
string key = tmp.CheckID.ToString();
|
||||||
_DTS = tmp.DTS;
|
ConvertListToDictionary();
|
||||||
_UserID = tmp.UserID;
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
_CheckInfoExtension.Refresh(this);
|
foreach (CheckInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
OnChange();// raise an event
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
public static void Refresh(RevisionCheck tmp)
|
protected virtual void RefreshFields(RevisionCheck tmp)
|
||||||
{
|
{
|
||||||
string key = tmp.CheckID.ToString();
|
if (_StageID != tmp.StageID)
|
||||||
ConvertListToDictionary();
|
{
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
if (MyStage != null) MyStage.RefreshStageChecks(); // Update List for old value
|
||||||
foreach (CheckInfo tmpInfo in _CacheByPrimaryKey[key])
|
_StageID = tmp.StageID; // Update the value
|
||||||
tmpInfo.RefreshFields(tmp);
|
}
|
||||||
}
|
_MyStage = null; // Reset list so that the next line gets a new list
|
||||||
protected virtual void RefreshFields(RevisionCheck tmp)
|
if (MyStage != null) MyStage.RefreshStageChecks(); // Update List for new value
|
||||||
{
|
_ConsistencyChecks = tmp.ConsistencyChecks;
|
||||||
if (_StageID != tmp.StageID)
|
_DTS = tmp.DTS;
|
||||||
{
|
_UserID = tmp.UserID;
|
||||||
if (MyStage != null) MyStage.RefreshStageChecks(); // Update List for old value
|
_CheckInfoExtension.Refresh(this);
|
||||||
_StageID = tmp.StageID; // Update the value
|
OnChange();// raise an event
|
||||||
}
|
}
|
||||||
_MyStage = null; // Reset list so that the next line gets a new list
|
public static void Refresh(StageCheck tmp)
|
||||||
if (MyStage != null) MyStage.RefreshStageChecks(); // Update List for new value
|
{
|
||||||
_ConsistencyChecks = tmp.ConsistencyChecks;
|
string key = tmp.CheckID.ToString();
|
||||||
_DTS = tmp.DTS;
|
ConvertListToDictionary();
|
||||||
_UserID = tmp.UserID;
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
_CheckInfoExtension.Refresh(this);
|
foreach (CheckInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
OnChange();// raise an event
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
public static void Refresh(StageCheck tmp)
|
protected virtual void RefreshFields(StageCheck tmp)
|
||||||
{
|
{
|
||||||
string key = tmp.CheckID.ToString();
|
if (_RevisionID != tmp.RevisionID)
|
||||||
ConvertListToDictionary();
|
{
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
if (MyRevision != null) MyRevision.RefreshRevisionChecks(); // Update List for old value
|
||||||
foreach (CheckInfo tmpInfo in _CacheByPrimaryKey[key])
|
_RevisionID = tmp.RevisionID; // Update the value
|
||||||
tmpInfo.RefreshFields(tmp);
|
}
|
||||||
}
|
_MyRevision = null; // Reset list so that the next line gets a new list
|
||||||
protected virtual void RefreshFields(StageCheck tmp)
|
if (MyRevision != null) MyRevision.RefreshRevisionChecks(); // Update List for new value
|
||||||
{
|
_ConsistencyChecks = tmp.ConsistencyChecks;
|
||||||
if (_RevisionID != tmp.RevisionID)
|
_DTS = tmp.DTS;
|
||||||
{
|
_UserID = tmp.UserID;
|
||||||
if (MyRevision != null) MyRevision.RefreshRevisionChecks(); // Update List for old value
|
_CheckInfoExtension.Refresh(this);
|
||||||
_RevisionID = tmp.RevisionID; // Update the value
|
OnChange();// raise an event
|
||||||
}
|
}
|
||||||
_MyRevision = null; // Reset list so that the next line gets a new list
|
public static CheckInfo Get(int checkID)
|
||||||
if (MyRevision != null) MyRevision.RefreshRevisionChecks(); // Update List for new value
|
{
|
||||||
_ConsistencyChecks = tmp.ConsistencyChecks;
|
//if (!CanGetObject())
|
||||||
_DTS = tmp.DTS;
|
// throw new System.Security.SecurityException("User not authorized to view a Check");
|
||||||
_UserID = tmp.UserID;
|
try
|
||||||
_CheckInfoExtension.Refresh(this);
|
{
|
||||||
OnChange();// raise an event
|
CheckInfo tmp = GetCachedByPrimaryKey(checkID);
|
||||||
}
|
if (tmp == null)
|
||||||
public static CheckInfo Get(int checkID)
|
{
|
||||||
{
|
tmp = DataPortal.Fetch<CheckInfo>(new PKCriteria(checkID));
|
||||||
//if (!CanGetObject())
|
AddToCache(tmp);
|
||||||
// throw new System.Security.SecurityException("User not authorized to view a Check");
|
}
|
||||||
try
|
if (tmp.ErrorMessage == "No Record Found")
|
||||||
{
|
{
|
||||||
CheckInfo tmp = GetCachedByPrimaryKey(checkID);
|
tmp.Dispose(); // Clean-up CheckInfo
|
||||||
if (tmp == null)
|
tmp = null;
|
||||||
{
|
}
|
||||||
tmp = DataPortal.Fetch<CheckInfo>(new PKCriteria(checkID));
|
return tmp;
|
||||||
AddToCache(tmp);
|
}
|
||||||
}
|
catch (Exception ex)
|
||||||
if (tmp.ErrorMessage == "No Record Found")
|
{
|
||||||
{
|
throw new DbCslaException("Error on CheckInfo.Get", ex);
|
||||||
tmp.Dispose(); // Clean-up CheckInfo
|
}
|
||||||
tmp = null;
|
}
|
||||||
}
|
#endregion
|
||||||
return tmp;
|
#region Data Access Portal
|
||||||
}
|
internal CheckInfo(SafeDataReader dr)
|
||||||
catch (Exception ex)
|
{
|
||||||
{
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] CheckInfo.Constructor", GetHashCode());
|
||||||
throw new DbCslaException("Error on CheckInfo.Get", ex);
|
try
|
||||||
}
|
{
|
||||||
}
|
ReadData(dr);
|
||||||
#endregion
|
}
|
||||||
#region Data Access Portal
|
catch (Exception ex)
|
||||||
internal CheckInfo(SafeDataReader dr)
|
{
|
||||||
{
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("CheckInfo.Constructor", ex);
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] CheckInfo.Constructor", GetHashCode());
|
throw new DbCslaException("CheckInfo.Constructor", ex);
|
||||||
try
|
}
|
||||||
{
|
}
|
||||||
ReadData(dr);
|
[Serializable()]
|
||||||
}
|
protected class PKCriteria
|
||||||
catch (Exception ex)
|
{
|
||||||
{
|
private int _CheckID;
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("CheckInfo.Constructor", ex);
|
public int CheckID
|
||||||
throw new DbCslaException("CheckInfo.Constructor", ex);
|
{ get { return _CheckID; } }
|
||||||
}
|
public PKCriteria(int checkID)
|
||||||
}
|
{
|
||||||
[Serializable()]
|
_CheckID = checkID;
|
||||||
protected class PKCriteria
|
}
|
||||||
{
|
}
|
||||||
private int _CheckID;
|
private void ReadData(SafeDataReader dr)
|
||||||
public int CheckID
|
{
|
||||||
{ get { return _CheckID; } }
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] CheckInfo.ReadData", GetHashCode());
|
||||||
public PKCriteria(int checkID)
|
try
|
||||||
{
|
{
|
||||||
_CheckID = checkID;
|
_CheckID = dr.GetInt32("CheckID");
|
||||||
}
|
_RevisionID = dr.GetInt32("RevisionID");
|
||||||
}
|
_StageID = dr.GetInt32("StageID");
|
||||||
private void ReadData(SafeDataReader dr)
|
_ConsistencyChecks = dr.GetString("ConsistencyChecks");
|
||||||
{
|
_DTS = dr.GetDateTime("DTS");
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] CheckInfo.ReadData", GetHashCode());
|
_UserID = dr.GetString("UserID");
|
||||||
try
|
}
|
||||||
{
|
catch (Exception ex)
|
||||||
_CheckID = dr.GetInt32("CheckID");
|
{
|
||||||
_RevisionID = dr.GetInt32("RevisionID");
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("CheckInfo.ReadData", ex);
|
||||||
_StageID = dr.GetInt32("StageID");
|
_ErrorMessage = ex.Message;
|
||||||
_ConsistencyChecks = dr.GetString("ConsistencyChecks");
|
throw new DbCslaException("CheckInfo.ReadData", ex);
|
||||||
_DTS = dr.GetDateTime("DTS");
|
}
|
||||||
_UserID = dr.GetString("UserID");
|
}
|
||||||
}
|
private void DataPortal_Fetch(PKCriteria criteria)
|
||||||
catch (Exception ex)
|
{
|
||||||
{
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] CheckInfo.DataPortal_Fetch", GetHashCode());
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("CheckInfo.ReadData", ex);
|
try
|
||||||
_ErrorMessage = ex.Message;
|
{
|
||||||
throw new DbCslaException("CheckInfo.ReadData", ex);
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
}
|
{
|
||||||
}
|
ApplicationContext.LocalContext["cn"] = cn;
|
||||||
private void DataPortal_Fetch(PKCriteria criteria)
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
{
|
{
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] CheckInfo.DataPortal_Fetch", GetHashCode());
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
try
|
cm.CommandText = "getCheck";
|
||||||
{
|
cm.Parameters.AddWithValue("@CheckID", criteria.CheckID);
|
||||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
{
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
ApplicationContext.LocalContext["cn"] = cn;
|
{
|
||||||
using (SqlCommand cm = cn.CreateCommand())
|
if (!dr.Read())
|
||||||
{
|
{
|
||||||
cm.CommandType = CommandType.StoredProcedure;
|
_ErrorMessage = "No Record Found";
|
||||||
cm.CommandText = "getCheck";
|
return;
|
||||||
cm.Parameters.AddWithValue("@CheckID", criteria.CheckID);
|
}
|
||||||
cm.CommandTimeout = Database.DefaultTimeout;
|
ReadData(dr);
|
||||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
}
|
||||||
{
|
}
|
||||||
if (!dr.Read())
|
// removing of item only needed for local data portal
|
||||||
{
|
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
||||||
_ErrorMessage = "No Record Found";
|
ApplicationContext.LocalContext.Remove("cn");
|
||||||
return;
|
}
|
||||||
}
|
}
|
||||||
ReadData(dr);
|
catch (Exception ex)
|
||||||
}
|
{
|
||||||
}
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("CheckInfo.DataPortal_Fetch", ex);
|
||||||
// removing of item only needed for local data portal
|
_ErrorMessage = ex.Message;
|
||||||
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
throw new DbCslaException("CheckInfo.DataPortal_Fetch", ex);
|
||||||
ApplicationContext.LocalContext.Remove("cn");
|
}
|
||||||
}
|
}
|
||||||
}
|
#endregion
|
||||||
catch (Exception ex)
|
// Standard Refresh
|
||||||
{
|
#region extension
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("CheckInfo.DataPortal_Fetch", ex);
|
CheckInfoExtension _CheckInfoExtension = new CheckInfoExtension();
|
||||||
_ErrorMessage = ex.Message;
|
[Serializable()]
|
||||||
throw new DbCslaException("CheckInfo.DataPortal_Fetch", ex);
|
partial class CheckInfoExtension : extensionBase { }
|
||||||
}
|
[Serializable()]
|
||||||
}
|
class extensionBase
|
||||||
#endregion
|
{
|
||||||
// Standard Refresh
|
// Default Refresh
|
||||||
#region extension
|
public virtual void Refresh(CheckInfo tmp) { }
|
||||||
CheckInfoExtension _CheckInfoExtension = new CheckInfoExtension();
|
}
|
||||||
[Serializable()]
|
#endregion
|
||||||
partial class CheckInfoExtension : extensionBase { }
|
} // Class
|
||||||
[Serializable()]
|
#region Converter
|
||||||
class extensionBase
|
internal class CheckInfoConverter : ExpandableObjectConverter
|
||||||
{
|
{
|
||||||
// Default Refresh
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
public virtual void Refresh(CheckInfo tmp) { }
|
{
|
||||||
}
|
if (destType == typeof(string) && value is CheckInfo)
|
||||||
#endregion
|
{
|
||||||
} // Class
|
// Return the ToString value
|
||||||
#region Converter
|
return ((CheckInfo)value).ToString();
|
||||||
internal class CheckInfoConverter : ExpandableObjectConverter
|
}
|
||||||
{
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
}
|
||||||
{
|
}
|
||||||
if (destType == typeof(string) && value is CheckInfo)
|
#endregion
|
||||||
{
|
|
||||||
// Return the ToString value
|
|
||||||
return ((CheckInfo)value).ToString();
|
|
||||||
}
|
|
||||||
return base.ConvertTo(context, culture, value, destType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -19,415 +19,405 @@ using System.ComponentModel;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
public delegate void ConnectionInfoEvent(object sender);
|
public delegate void ConnectionInfoEvent(object sender);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ConnectionInfo Generated by MyGeneration using the CSLA Object Mapping template
|
/// ConnectionInfo Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
[TypeConverter(typeof(ConnectionInfoConverter))]
|
[TypeConverter(typeof(ConnectionInfoConverter))]
|
||||||
public partial class ConnectionInfo : ReadOnlyBase<ConnectionInfo>, IDisposable
|
public partial class ConnectionInfo : ReadOnlyBase<ConnectionInfo>, IDisposable
|
||||||
{
|
{
|
||||||
public event ConnectionInfoEvent Changed;
|
public event ConnectionInfoEvent Changed;
|
||||||
private void OnChange()
|
private void OnChange()
|
||||||
{
|
{
|
||||||
if (Changed != null) Changed(this);
|
if (Changed != null) Changed(this);
|
||||||
}
|
}
|
||||||
#region Log4Net
|
#region Log4Net
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
private static List<ConnectionInfo> _CacheList = new List<ConnectionInfo>();
|
private static List<ConnectionInfo> _CacheList = new List<ConnectionInfo>();
|
||||||
protected static void AddToCache(ConnectionInfo connectionInfo)
|
protected static void AddToCache(ConnectionInfo connectionInfo)
|
||||||
{
|
{
|
||||||
if (!_CacheList.Contains(connectionInfo)) _CacheList.Add(connectionInfo); // In AddToCache
|
if (!_CacheList.Contains(connectionInfo)) _CacheList.Add(connectionInfo); // In AddToCache
|
||||||
}
|
}
|
||||||
protected static void RemoveFromCache(ConnectionInfo connectionInfo)
|
protected static void RemoveFromCache(ConnectionInfo connectionInfo)
|
||||||
{
|
{
|
||||||
while (_CacheList.Contains(connectionInfo)) _CacheList.Remove(connectionInfo); // In RemoveFromCache
|
while (_CacheList.Contains(connectionInfo)) _CacheList.Remove(connectionInfo); // In RemoveFromCache
|
||||||
}
|
}
|
||||||
private static Dictionary<string, List<ConnectionInfo>> _CacheByPrimaryKey = new Dictionary<string, List<ConnectionInfo>>();
|
private static Dictionary<string, List<ConnectionInfo>> _CacheByPrimaryKey = new Dictionary<string, List<ConnectionInfo>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
while (_CacheList.Count > 0) // Move ConnectionInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
while (_CacheList.Count > 0) // Move ConnectionInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
||||||
{
|
{
|
||||||
ConnectionInfo tmp = _CacheList[0]; // Get the first ConnectionInfo
|
ConnectionInfo tmp = _CacheList[0]; // Get the first ConnectionInfo
|
||||||
string pKey = tmp.DBID.ToString();
|
string pKey = tmp.DBID.ToString();
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
||||||
{
|
{
|
||||||
_CacheByPrimaryKey[pKey] = new List<ConnectionInfo>(); // Add new list for PrimaryKey
|
_CacheByPrimaryKey[pKey] = new List<ConnectionInfo>(); // Add new list for PrimaryKey
|
||||||
}
|
}
|
||||||
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
||||||
_CacheList.RemoveAt(0); // Remove the first ConnectionInfo
|
_CacheList.RemoveAt(0); // Remove the first ConnectionInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
internal static void AddList(ConnectionInfoList lst)
|
internal static void AddList(ConnectionInfoList lst)
|
||||||
{
|
{
|
||||||
foreach (ConnectionInfo item in lst) AddToCache(item);
|
foreach (ConnectionInfo item in lst) AddToCache(item);
|
||||||
}
|
}
|
||||||
protected static ConnectionInfo GetCachedByPrimaryKey(int dbid)
|
protected static ConnectionInfo GetCachedByPrimaryKey(int dbid)
|
||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = dbid.ToString();
|
string key = dbid.ToString();
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Business Methods
|
#region Business Methods
|
||||||
private string _ErrorMessage = string.Empty;
|
private string _ErrorMessage = string.Empty;
|
||||||
public string ErrorMessage
|
public string ErrorMessage
|
||||||
{
|
{
|
||||||
get { return _ErrorMessage; }
|
get { return _ErrorMessage; }
|
||||||
}
|
}
|
||||||
protected Connection _Editable;
|
protected Connection _Editable;
|
||||||
private IVEHasBrokenRules HasBrokenRules
|
private IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
IVEHasBrokenRules hasBrokenRules = null;
|
IVEHasBrokenRules hasBrokenRules = null;
|
||||||
if (_Editable != null)
|
if (_Editable != null)
|
||||||
hasBrokenRules = _Editable.HasBrokenRules;
|
hasBrokenRules = _Editable.HasBrokenRules;
|
||||||
return hasBrokenRules;
|
return hasBrokenRules;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private int _DBID;
|
private int _DBID;
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
public int DBID
|
public int DBID
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("DBID", true);
|
return _DBID;
|
||||||
return _DBID;
|
}
|
||||||
}
|
}
|
||||||
}
|
private string _Name = string.Empty;
|
||||||
private string _Name = string.Empty;
|
public string Name
|
||||||
public string Name
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
get
|
||||||
get
|
{
|
||||||
{
|
return _Name;
|
||||||
CanReadProperty("Name", true);
|
}
|
||||||
return _Name;
|
}
|
||||||
}
|
private string _Title = string.Empty;
|
||||||
}
|
public string Title
|
||||||
private string _Title = string.Empty;
|
{
|
||||||
public string Title
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
return _Title;
|
||||||
{
|
}
|
||||||
CanReadProperty("Title", true);
|
}
|
||||||
return _Title;
|
private string _ConnectionString = string.Empty;
|
||||||
}
|
public string ConnectionString
|
||||||
}
|
{
|
||||||
private string _ConnectionString = string.Empty;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
public string ConnectionString
|
get
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
return _ConnectionString;
|
||||||
get
|
}
|
||||||
{
|
}
|
||||||
CanReadProperty("ConnectionString", true);
|
private int _ServerType;
|
||||||
return _ConnectionString;
|
/// <summary>
|
||||||
}
|
/// 0 SQL Server
|
||||||
}
|
/// </summary>
|
||||||
private int _ServerType;
|
public int ServerType
|
||||||
/// <summary>
|
{
|
||||||
/// 0 SQL Server
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
/// </summary>
|
get
|
||||||
public int ServerType
|
{
|
||||||
{
|
return _ServerType;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
}
|
||||||
{
|
private string _Config = string.Empty;
|
||||||
CanReadProperty("ServerType", true);
|
public string Config
|
||||||
return _ServerType;
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
private string _Config = string.Empty;
|
{
|
||||||
public string Config
|
return _Config;
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
private DateTime _DTS = new DateTime();
|
||||||
{
|
public DateTime DTS
|
||||||
CanReadProperty("Config", true);
|
{
|
||||||
return _Config;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
}
|
{
|
||||||
private DateTime _DTS = new DateTime();
|
return _DTS;
|
||||||
public DateTime DTS
|
}
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
private string _UsrID = string.Empty;
|
||||||
get
|
public string UsrID
|
||||||
{
|
{
|
||||||
CanReadProperty("DTS", true);
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
return _DTS;
|
get
|
||||||
}
|
{
|
||||||
}
|
return _UsrID;
|
||||||
private string _UsrID = string.Empty;
|
}
|
||||||
public string UsrID
|
}
|
||||||
{
|
private int _ConnectionFolderCount = 0;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
/// <summary>
|
||||||
get
|
/// Count of ConnectionFolders for this Connection
|
||||||
{
|
/// </summary>
|
||||||
CanReadProperty("UsrID", true);
|
public int ConnectionFolderCount
|
||||||
return _UsrID;
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
private int _ConnectionFolderCount = 0;
|
{
|
||||||
/// <summary>
|
if (_ConnectionFolderCount < 0)
|
||||||
/// Count of ConnectionFolders for this Connection
|
_ConnectionFolderCount = ConnectionFolders.Count;
|
||||||
/// </summary>
|
return _ConnectionFolderCount;
|
||||||
public int ConnectionFolderCount
|
}
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
private FolderInfoList _ConnectionFolders = null;
|
||||||
get
|
[TypeConverter(typeof(FolderInfoListConverter))]
|
||||||
{
|
public FolderInfoList ConnectionFolders
|
||||||
CanReadProperty("ConnectionFolderCount", true);
|
{
|
||||||
if (_ConnectionFolderCount < 0)
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
_ConnectionFolderCount = ConnectionFolders.Count;
|
get
|
||||||
return _ConnectionFolderCount;
|
{
|
||||||
}
|
if (_ConnectionFolderCount < 0 || (_ConnectionFolderCount > 0 && _ConnectionFolders == null))
|
||||||
}
|
_ConnectionFolders = FolderInfoList.GetByDBID(_DBID);
|
||||||
private FolderInfoList _ConnectionFolders = null;
|
if (_ConnectionFolderCount < 0)
|
||||||
[TypeConverter(typeof(FolderInfoListConverter))]
|
_ConnectionFolderCount = _ConnectionFolders.Count;
|
||||||
public FolderInfoList ConnectionFolders
|
return _ConnectionFolders;
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
public void RefreshConnectionFolders()
|
||||||
{
|
{
|
||||||
CanReadProperty("ConnectionFolders", true);
|
_ConnectionFolderCount = -1;
|
||||||
if (_ConnectionFolderCount < 0 || (_ConnectionFolderCount > 0 && _ConnectionFolders == null))
|
ConvertListToDictionary();
|
||||||
_ConnectionFolders = FolderInfoList.GetByDBID(_DBID);
|
if (_CacheByPrimaryKey.ContainsKey(_DBID.ToString()))
|
||||||
if (_ConnectionFolderCount < 0)
|
foreach (ConnectionInfo tmp in _CacheByPrimaryKey[_DBID.ToString()])
|
||||||
_ConnectionFolderCount = _ConnectionFolders.Count;
|
tmp._ConnectionFolderCount = -1; // This will cause the data to be requeried
|
||||||
return _ConnectionFolders;
|
}
|
||||||
}
|
// CSLATODO: Replace base ConnectionInfo.ToString function as necessary
|
||||||
}
|
/// <summary>
|
||||||
public void RefreshConnectionFolders()
|
/// Overrides Base ToString
|
||||||
{
|
/// </summary>
|
||||||
_ConnectionFolderCount = -1;
|
/// <returns>A string representation of current ConnectionInfo</returns>
|
||||||
ConvertListToDictionary();
|
//public override string ToString()
|
||||||
if (_CacheByPrimaryKey.ContainsKey(_DBID.ToString()))
|
//{
|
||||||
foreach (ConnectionInfo tmp in _CacheByPrimaryKey[_DBID.ToString()])
|
// return base.ToString();
|
||||||
tmp._ConnectionFolderCount = -1; // This will cause the data to be requeried
|
//}
|
||||||
}
|
// CSLATODO: Check ConnectionInfo.GetIdValue to assure that the ID returned is unique
|
||||||
// CSLATODO: Replace base ConnectionInfo.ToString function as necessary
|
/// <summary>
|
||||||
/// <summary>
|
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||||
/// Overrides Base ToString
|
/// </summary>
|
||||||
/// </summary>
|
/// <returns>A Unique ID for the current ConnectionInfo</returns>
|
||||||
/// <returns>A string representation of current ConnectionInfo</returns>
|
protected override object GetIdValue()
|
||||||
//public override string ToString()
|
{
|
||||||
//{
|
return MyConnectionInfoUnique; // Absolutely Unique ID
|
||||||
// return base.ToString();
|
}
|
||||||
//}
|
#endregion
|
||||||
// CSLATODO: Check ConnectionInfo.GetIdValue to assure that the ID returned is unique
|
#region Factory Methods
|
||||||
/// <summary>
|
private static int _ConnectionInfoUnique = 0;
|
||||||
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
private static int ConnectionInfoUnique
|
||||||
/// </summary>
|
{ get { return ++_ConnectionInfoUnique; } }
|
||||||
/// <returns>A Unique ID for the current ConnectionInfo</returns>
|
private int _MyConnectionInfoUnique = ConnectionInfoUnique;
|
||||||
protected override object GetIdValue()
|
public int MyConnectionInfoUnique // Absolutely Unique ID - Info
|
||||||
{
|
{ get { return _MyConnectionInfoUnique; } }
|
||||||
return MyConnectionInfoUnique; // Absolutely Unique ID
|
protected ConnectionInfo()
|
||||||
}
|
{/* require use of factory methods */
|
||||||
#endregion
|
AddToCache(this);
|
||||||
#region Factory Methods
|
}
|
||||||
private static int _ConnectionInfoUnique = 0;
|
private bool _Disposed = false;
|
||||||
private static int ConnectionInfoUnique
|
private static int _CountCreated = 0;
|
||||||
{ get { return ++_ConnectionInfoUnique; } }
|
private static int _CountDisposed = 0;
|
||||||
private int _MyConnectionInfoUnique = ConnectionInfoUnique;
|
private static int _CountFinalized = 0;
|
||||||
public int MyConnectionInfoUnique // Absolutely Unique ID - Info
|
private static int IncrementCountCreated
|
||||||
{ get { return _MyConnectionInfoUnique; } }
|
{ get { return ++_CountCreated; } }
|
||||||
protected ConnectionInfo()
|
private int _CountWhenCreated = IncrementCountCreated;
|
||||||
{/* require use of factory methods */
|
public static int CountCreated
|
||||||
AddToCache(this);
|
{ get { return _CountCreated; } }
|
||||||
}
|
public static int CountNotDisposed
|
||||||
private bool _Disposed = false;
|
{ get { return _CountCreated - _CountDisposed; } }
|
||||||
private static int _CountCreated = 0;
|
public static int CountNotFinalized
|
||||||
private static int _CountDisposed = 0;
|
{ get { return _CountCreated - _CountFinalized; } }
|
||||||
private static int _CountFinalized = 0;
|
~ConnectionInfo()
|
||||||
private static int IncrementCountCreated
|
{
|
||||||
{ get { return ++_CountCreated; } }
|
_CountFinalized++;
|
||||||
private int _CountWhenCreated = IncrementCountCreated;
|
}
|
||||||
public static int CountCreated
|
public void Dispose()
|
||||||
{ get { return _CountCreated; } }
|
{
|
||||||
public static int CountNotDisposed
|
if (_Disposed) return;
|
||||||
{ get { return _CountCreated - _CountDisposed; } }
|
_CountDisposed++;
|
||||||
public static int CountNotFinalized
|
_Disposed = true;
|
||||||
{ get { return _CountCreated - _CountFinalized; } }
|
RemoveFromCache(this);
|
||||||
~ConnectionInfo()
|
if (!_CacheByPrimaryKey.ContainsKey(DBID.ToString())) return;
|
||||||
{
|
List<ConnectionInfo> listConnectionInfo = _CacheByPrimaryKey[DBID.ToString()]; // Get the list of items
|
||||||
_CountFinalized++;
|
while (listConnectionInfo.Contains(this)) listConnectionInfo.Remove(this); // Remove the item from the list
|
||||||
}
|
if (listConnectionInfo.Count == 0) // If there are no items left in the list
|
||||||
public void Dispose()
|
_CacheByPrimaryKey.Remove(DBID.ToString()); // remove the list
|
||||||
{
|
}
|
||||||
if (_Disposed) return;
|
public virtual Connection Get()
|
||||||
_CountDisposed++;
|
{
|
||||||
_Disposed = true;
|
return _Editable = Connection.Get(_DBID);
|
||||||
RemoveFromCache(this);
|
}
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(DBID.ToString())) return;
|
public static void Refresh(Connection tmp)
|
||||||
List<ConnectionInfo> listConnectionInfo = _CacheByPrimaryKey[DBID.ToString()]; // Get the list of items
|
{
|
||||||
while (listConnectionInfo.Contains(this)) listConnectionInfo.Remove(this); // Remove the item from the list
|
string key = tmp.DBID.ToString();
|
||||||
if (listConnectionInfo.Count == 0) // If there are no items left in the list
|
ConvertListToDictionary();
|
||||||
_CacheByPrimaryKey.Remove(DBID.ToString()); // remove the list
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
}
|
foreach (ConnectionInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
public virtual Connection Get()
|
tmpInfo.RefreshFields(tmp);
|
||||||
{
|
}
|
||||||
return _Editable = Connection.Get(_DBID);
|
protected virtual void RefreshFields(Connection tmp)
|
||||||
}
|
{
|
||||||
public static void Refresh(Connection tmp)
|
_Name = tmp.Name;
|
||||||
{
|
_Title = tmp.Title;
|
||||||
string key = tmp.DBID.ToString();
|
_ConnectionString = tmp.ConnectionString;
|
||||||
ConvertListToDictionary();
|
_ServerType = tmp.ServerType;
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
_Config = tmp.Config;
|
||||||
foreach (ConnectionInfo tmpInfo in _CacheByPrimaryKey[key])
|
_DTS = tmp.DTS;
|
||||||
tmpInfo.RefreshFields(tmp);
|
_UsrID = tmp.UsrID;
|
||||||
}
|
_ConnectionInfoExtension.Refresh(this);
|
||||||
protected virtual void RefreshFields(Connection tmp)
|
OnChange();// raise an event
|
||||||
{
|
}
|
||||||
_Name = tmp.Name;
|
public static ConnectionInfo Get(int dbid)
|
||||||
_Title = tmp.Title;
|
{
|
||||||
_ConnectionString = tmp.ConnectionString;
|
//if (!CanGetObject())
|
||||||
_ServerType = tmp.ServerType;
|
// throw new System.Security.SecurityException("User not authorized to view a Connection");
|
||||||
_Config = tmp.Config;
|
try
|
||||||
_DTS = tmp.DTS;
|
{
|
||||||
_UsrID = tmp.UsrID;
|
ConnectionInfo tmp = GetCachedByPrimaryKey(dbid);
|
||||||
_ConnectionInfoExtension.Refresh(this);
|
if (tmp == null)
|
||||||
OnChange();// raise an event
|
{
|
||||||
}
|
tmp = DataPortal.Fetch<ConnectionInfo>(new PKCriteria(dbid));
|
||||||
public static ConnectionInfo Get(int dbid)
|
AddToCache(tmp);
|
||||||
{
|
}
|
||||||
//if (!CanGetObject())
|
if (tmp.ErrorMessage == "No Record Found")
|
||||||
// throw new System.Security.SecurityException("User not authorized to view a Connection");
|
{
|
||||||
try
|
tmp.Dispose(); // Clean-up ConnectionInfo
|
||||||
{
|
tmp = null;
|
||||||
ConnectionInfo tmp = GetCachedByPrimaryKey(dbid);
|
}
|
||||||
if (tmp == null)
|
return tmp;
|
||||||
{
|
}
|
||||||
tmp = DataPortal.Fetch<ConnectionInfo>(new PKCriteria(dbid));
|
catch (Exception ex)
|
||||||
AddToCache(tmp);
|
{
|
||||||
}
|
throw new DbCslaException("Error on ConnectionInfo.Get", ex);
|
||||||
if (tmp.ErrorMessage == "No Record Found")
|
}
|
||||||
{
|
}
|
||||||
tmp.Dispose(); // Clean-up ConnectionInfo
|
#endregion
|
||||||
tmp = null;
|
#region Data Access Portal
|
||||||
}
|
internal ConnectionInfo(SafeDataReader dr)
|
||||||
return tmp;
|
{
|
||||||
}
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ConnectionInfo.Constructor", GetHashCode());
|
||||||
catch (Exception ex)
|
try
|
||||||
{
|
{
|
||||||
throw new DbCslaException("Error on ConnectionInfo.Get", ex);
|
ReadData(dr);
|
||||||
}
|
}
|
||||||
}
|
catch (Exception ex)
|
||||||
#endregion
|
{
|
||||||
#region Data Access Portal
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("ConnectionInfo.Constructor", ex);
|
||||||
internal ConnectionInfo(SafeDataReader dr)
|
throw new DbCslaException("ConnectionInfo.Constructor", ex);
|
||||||
{
|
}
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ConnectionInfo.Constructor", GetHashCode());
|
}
|
||||||
try
|
[Serializable()]
|
||||||
{
|
protected class PKCriteria
|
||||||
ReadData(dr);
|
{
|
||||||
}
|
private int _DBID;
|
||||||
catch (Exception ex)
|
public int DBID
|
||||||
{
|
{ get { return _DBID; } }
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ConnectionInfo.Constructor", ex);
|
public PKCriteria(int dbid)
|
||||||
throw new DbCslaException("ConnectionInfo.Constructor", ex);
|
{
|
||||||
}
|
_DBID = dbid;
|
||||||
}
|
}
|
||||||
[Serializable()]
|
}
|
||||||
protected class PKCriteria
|
private void ReadData(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
private int _DBID;
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ConnectionInfo.ReadData", GetHashCode());
|
||||||
public int DBID
|
try
|
||||||
{ get { return _DBID; } }
|
{
|
||||||
public PKCriteria(int dbid)
|
_DBID = dr.GetInt32("DBID");
|
||||||
{
|
_Name = dr.GetString("Name");
|
||||||
_DBID = dbid;
|
_Title = dr.GetString("Title");
|
||||||
}
|
_ConnectionString = dr.GetString("ConnectionString");
|
||||||
}
|
_ServerType = dr.GetInt32("ServerType");
|
||||||
private void ReadData(SafeDataReader dr)
|
_Config = dr.GetString("Config");
|
||||||
{
|
_DTS = dr.GetDateTime("DTS");
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ConnectionInfo.ReadData", GetHashCode());
|
_UsrID = dr.GetString("UsrID");
|
||||||
try
|
_ConnectionFolderCount = dr.GetInt32("FolderCount");
|
||||||
{
|
}
|
||||||
_DBID = dr.GetInt32("DBID");
|
catch (Exception ex)
|
||||||
_Name = dr.GetString("Name");
|
{
|
||||||
_Title = dr.GetString("Title");
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("ConnectionInfo.ReadData", ex);
|
||||||
_ConnectionString = dr.GetString("ConnectionString");
|
_ErrorMessage = ex.Message;
|
||||||
_ServerType = dr.GetInt32("ServerType");
|
throw new DbCslaException("ConnectionInfo.ReadData", ex);
|
||||||
_Config = dr.GetString("Config");
|
}
|
||||||
_DTS = dr.GetDateTime("DTS");
|
}
|
||||||
_UsrID = dr.GetString("UsrID");
|
private void DataPortal_Fetch(PKCriteria criteria)
|
||||||
_ConnectionFolderCount = dr.GetInt32("FolderCount");
|
{
|
||||||
}
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ConnectionInfo.DataPortal_Fetch", GetHashCode());
|
||||||
catch (Exception ex)
|
try
|
||||||
{
|
{
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ConnectionInfo.ReadData", ex);
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
_ErrorMessage = ex.Message;
|
{
|
||||||
throw new DbCslaException("ConnectionInfo.ReadData", ex);
|
ApplicationContext.LocalContext["cn"] = cn;
|
||||||
}
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
}
|
{
|
||||||
private void DataPortal_Fetch(PKCriteria criteria)
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
{
|
cm.CommandText = "getConnection";
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ConnectionInfo.DataPortal_Fetch", GetHashCode());
|
cm.Parameters.AddWithValue("@DBID", criteria.DBID);
|
||||||
try
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
{
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
{
|
||||||
{
|
if (!dr.Read())
|
||||||
ApplicationContext.LocalContext["cn"] = cn;
|
{
|
||||||
using (SqlCommand cm = cn.CreateCommand())
|
_ErrorMessage = "No Record Found";
|
||||||
{
|
return;
|
||||||
cm.CommandType = CommandType.StoredProcedure;
|
}
|
||||||
cm.CommandText = "getConnection";
|
ReadData(dr);
|
||||||
cm.Parameters.AddWithValue("@DBID", criteria.DBID);
|
}
|
||||||
cm.CommandTimeout = Database.DefaultTimeout;
|
}
|
||||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
// removing of item only needed for local data portal
|
||||||
{
|
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
||||||
if (!dr.Read())
|
ApplicationContext.LocalContext.Remove("cn");
|
||||||
{
|
}
|
||||||
_ErrorMessage = "No Record Found";
|
}
|
||||||
return;
|
catch (Exception ex)
|
||||||
}
|
{
|
||||||
ReadData(dr);
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("ConnectionInfo.DataPortal_Fetch", ex);
|
||||||
}
|
_ErrorMessage = ex.Message;
|
||||||
}
|
throw new DbCslaException("ConnectionInfo.DataPortal_Fetch", ex);
|
||||||
// removing of item only needed for local data portal
|
}
|
||||||
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
}
|
||||||
ApplicationContext.LocalContext.Remove("cn");
|
#endregion
|
||||||
}
|
// Standard Refresh
|
||||||
}
|
#region extension
|
||||||
catch (Exception ex)
|
ConnectionInfoExtension _ConnectionInfoExtension = new ConnectionInfoExtension();
|
||||||
{
|
[Serializable()]
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ConnectionInfo.DataPortal_Fetch", ex);
|
partial class ConnectionInfoExtension : extensionBase { }
|
||||||
_ErrorMessage = ex.Message;
|
[Serializable()]
|
||||||
throw new DbCslaException("ConnectionInfo.DataPortal_Fetch", ex);
|
class extensionBase
|
||||||
}
|
{
|
||||||
}
|
// Default Refresh
|
||||||
#endregion
|
public virtual void Refresh(ConnectionInfo tmp) { }
|
||||||
// Standard Refresh
|
}
|
||||||
#region extension
|
#endregion
|
||||||
ConnectionInfoExtension _ConnectionInfoExtension = new ConnectionInfoExtension();
|
} // Class
|
||||||
[Serializable()]
|
#region Converter
|
||||||
partial class ConnectionInfoExtension : extensionBase { }
|
internal class ConnectionInfoConverter : ExpandableObjectConverter
|
||||||
[Serializable()]
|
{
|
||||||
class extensionBase
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
{
|
{
|
||||||
// Default Refresh
|
if (destType == typeof(string) && value is ConnectionInfo)
|
||||||
public virtual void Refresh(ConnectionInfo tmp) { }
|
{
|
||||||
}
|
// Return the ToString value
|
||||||
#endregion
|
return ((ConnectionInfo)value).ToString();
|
||||||
} // Class
|
}
|
||||||
#region Converter
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
internal class ConnectionInfoConverter : ExpandableObjectConverter
|
}
|
||||||
{
|
}
|
||||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
#endregion
|
||||||
{
|
|
||||||
if (destType == typeof(string) && value is ConnectionInfo)
|
|
||||||
{
|
|
||||||
// Return the ToString value
|
|
||||||
return ((ConnectionInfo)value).ToString();
|
|
||||||
}
|
|
||||||
return base.ConvertTo(context, culture, value, destType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -19,397 +19,387 @@ using System.ComponentModel;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
public delegate void ContentAuditInfoEvent(object sender);
|
public delegate void ContentAuditInfoEvent(object sender);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ContentAuditInfo Generated by MyGeneration using the CSLA Object Mapping template
|
/// ContentAuditInfo Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
[TypeConverter(typeof(ContentAuditInfoConverter))]
|
[TypeConverter(typeof(ContentAuditInfoConverter))]
|
||||||
public partial class ContentAuditInfo : ReadOnlyBase<ContentAuditInfo>, IDisposable
|
public partial class ContentAuditInfo : ReadOnlyBase<ContentAuditInfo>, IDisposable
|
||||||
{
|
{
|
||||||
public event ContentAuditInfoEvent Changed;
|
public event ContentAuditInfoEvent Changed;
|
||||||
private void OnChange()
|
private void OnChange()
|
||||||
{
|
{
|
||||||
if (Changed != null) Changed(this);
|
if (Changed != null) Changed(this);
|
||||||
}
|
}
|
||||||
#region Log4Net
|
#region Log4Net
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
private static List<ContentAuditInfo> _CacheList = new List<ContentAuditInfo>();
|
private static List<ContentAuditInfo> _CacheList = new List<ContentAuditInfo>();
|
||||||
protected static void AddToCache(ContentAuditInfo contentAuditInfo)
|
protected static void AddToCache(ContentAuditInfo contentAuditInfo)
|
||||||
{
|
{
|
||||||
if (!_CacheList.Contains(contentAuditInfo)) _CacheList.Add(contentAuditInfo); // In AddToCache
|
if (!_CacheList.Contains(contentAuditInfo)) _CacheList.Add(contentAuditInfo); // In AddToCache
|
||||||
}
|
}
|
||||||
protected static void RemoveFromCache(ContentAuditInfo contentAuditInfo)
|
protected static void RemoveFromCache(ContentAuditInfo contentAuditInfo)
|
||||||
{
|
{
|
||||||
while (_CacheList.Contains(contentAuditInfo)) _CacheList.Remove(contentAuditInfo); // In RemoveFromCache
|
while (_CacheList.Contains(contentAuditInfo)) _CacheList.Remove(contentAuditInfo); // In RemoveFromCache
|
||||||
}
|
}
|
||||||
private static Dictionary<string, List<ContentAuditInfo>> _CacheByPrimaryKey = new Dictionary<string, List<ContentAuditInfo>>();
|
private static Dictionary<string, List<ContentAuditInfo>> _CacheByPrimaryKey = new Dictionary<string, List<ContentAuditInfo>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
while (_CacheList.Count > 0) // Move ContentAuditInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
while (_CacheList.Count > 0) // Move ContentAuditInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
||||||
{
|
{
|
||||||
ContentAuditInfo tmp = _CacheList[0]; // Get the first ContentAuditInfo
|
ContentAuditInfo tmp = _CacheList[0]; // Get the first ContentAuditInfo
|
||||||
string pKey = tmp.AuditID.ToString();
|
string pKey = tmp.AuditID.ToString();
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
||||||
{
|
{
|
||||||
_CacheByPrimaryKey[pKey] = new List<ContentAuditInfo>(); // Add new list for PrimaryKey
|
_CacheByPrimaryKey[pKey] = new List<ContentAuditInfo>(); // Add new list for PrimaryKey
|
||||||
}
|
}
|
||||||
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
||||||
_CacheList.RemoveAt(0); // Remove the first ContentAuditInfo
|
_CacheList.RemoveAt(0); // Remove the first ContentAuditInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
internal static void AddList(ContentAuditInfoList lst)
|
internal static void AddList(ContentAuditInfoList lst)
|
||||||
{
|
{
|
||||||
foreach (ContentAuditInfo item in lst) AddToCache(item);
|
foreach (ContentAuditInfo item in lst) AddToCache(item);
|
||||||
}
|
}
|
||||||
protected static ContentAuditInfo GetCachedByPrimaryKey(long auditID)
|
protected static ContentAuditInfo GetCachedByPrimaryKey(long auditID)
|
||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = auditID.ToString();
|
string key = auditID.ToString();
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Business Methods
|
#region Business Methods
|
||||||
private string _ErrorMessage = string.Empty;
|
private string _ErrorMessage = string.Empty;
|
||||||
public string ErrorMessage
|
public string ErrorMessage
|
||||||
{
|
{
|
||||||
get { return _ErrorMessage; }
|
get { return _ErrorMessage; }
|
||||||
}
|
}
|
||||||
protected ContentAudit _Editable;
|
protected ContentAudit _Editable;
|
||||||
private IVEHasBrokenRules HasBrokenRules
|
private IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
IVEHasBrokenRules hasBrokenRules = null;
|
IVEHasBrokenRules hasBrokenRules = null;
|
||||||
if (_Editable != null)
|
if (_Editable != null)
|
||||||
hasBrokenRules = _Editable.HasBrokenRules;
|
hasBrokenRules = _Editable.HasBrokenRules;
|
||||||
return hasBrokenRules;
|
return hasBrokenRules;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private long _AuditID;
|
private long _AuditID;
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
public long AuditID
|
public long AuditID
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("AuditID", true);
|
return _AuditID;
|
||||||
return _AuditID;
|
}
|
||||||
}
|
}
|
||||||
}
|
private int _ContentID;
|
||||||
private int _ContentID;
|
public int ContentID
|
||||||
public int ContentID
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
get
|
||||||
get
|
{
|
||||||
{
|
return _ContentID;
|
||||||
CanReadProperty("ContentID", true);
|
}
|
||||||
return _ContentID;
|
}
|
||||||
}
|
private string _Number = string.Empty;
|
||||||
}
|
public string Number
|
||||||
private string _Number = string.Empty;
|
{
|
||||||
public string Number
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
return _Number;
|
||||||
{
|
}
|
||||||
CanReadProperty("Number", true);
|
}
|
||||||
return _Number;
|
private string _Text = string.Empty;
|
||||||
}
|
public string Text
|
||||||
}
|
{
|
||||||
private string _Text = string.Empty;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
public string Text
|
get
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
return _Text;
|
||||||
get
|
}
|
||||||
{
|
}
|
||||||
CanReadProperty("Text", true);
|
private int? _Type;
|
||||||
return _Text;
|
public int? Type
|
||||||
}
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
private int? _Type;
|
get
|
||||||
public int? Type
|
{
|
||||||
{
|
return _Type;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
}
|
||||||
{
|
private int? _FormatID;
|
||||||
CanReadProperty("Type", true);
|
public int? FormatID
|
||||||
return _Type;
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
private int? _FormatID;
|
{
|
||||||
public int? FormatID
|
return _FormatID;
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
private string _Config = string.Empty;
|
||||||
{
|
public string Config
|
||||||
CanReadProperty("FormatID", true);
|
{
|
||||||
return _FormatID;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
}
|
{
|
||||||
private string _Config = string.Empty;
|
return _Config;
|
||||||
public string Config
|
}
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
private DateTime _DTS = new DateTime();
|
||||||
get
|
public DateTime DTS
|
||||||
{
|
{
|
||||||
CanReadProperty("Config", true);
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
return _Config;
|
get
|
||||||
}
|
{
|
||||||
}
|
return _DTS;
|
||||||
private DateTime _DTS = new DateTime();
|
}
|
||||||
public DateTime DTS
|
}
|
||||||
{
|
private string _UserID = string.Empty;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
public string UserID
|
||||||
get
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
CanReadProperty("DTS", true);
|
get
|
||||||
return _DTS;
|
{
|
||||||
}
|
return _UserID;
|
||||||
}
|
}
|
||||||
private string _UserID = string.Empty;
|
}
|
||||||
public string UserID
|
private int _DeleteStatus;
|
||||||
{
|
public int DeleteStatus
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
CanReadProperty("UserID", true);
|
{
|
||||||
return _UserID;
|
return _DeleteStatus;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private int _DeleteStatus;
|
// CSLATODO: Replace base ContentAuditInfo.ToString function as necessary
|
||||||
public int DeleteStatus
|
/// <summary>
|
||||||
{
|
/// Overrides Base ToString
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
/// </summary>
|
||||||
get
|
/// <returns>A string representation of current ContentAuditInfo</returns>
|
||||||
{
|
//public override string ToString()
|
||||||
CanReadProperty("DeleteStatus", true);
|
//{
|
||||||
return _DeleteStatus;
|
// return base.ToString();
|
||||||
}
|
//}
|
||||||
}
|
// CSLATODO: Check ContentAuditInfo.GetIdValue to assure that the ID returned is unique
|
||||||
// CSLATODO: Replace base ContentAuditInfo.ToString function as necessary
|
/// <summary>
|
||||||
/// <summary>
|
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||||
/// Overrides Base ToString
|
/// </summary>
|
||||||
/// </summary>
|
/// <returns>A Unique ID for the current ContentAuditInfo</returns>
|
||||||
/// <returns>A string representation of current ContentAuditInfo</returns>
|
protected override object GetIdValue()
|
||||||
//public override string ToString()
|
{
|
||||||
//{
|
return MyContentAuditInfoUnique; // Absolutely Unique ID
|
||||||
// return base.ToString();
|
}
|
||||||
//}
|
#endregion
|
||||||
// CSLATODO: Check ContentAuditInfo.GetIdValue to assure that the ID returned is unique
|
#region Factory Methods
|
||||||
/// <summary>
|
private static int _ContentAuditInfoUnique = 0;
|
||||||
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
private static int ContentAuditInfoUnique
|
||||||
/// </summary>
|
{ get { return ++_ContentAuditInfoUnique; } }
|
||||||
/// <returns>A Unique ID for the current ContentAuditInfo</returns>
|
private int _MyContentAuditInfoUnique = ContentAuditInfoUnique;
|
||||||
protected override object GetIdValue()
|
public int MyContentAuditInfoUnique // Absolutely Unique ID - Info
|
||||||
{
|
{ get { return _MyContentAuditInfoUnique; } }
|
||||||
return MyContentAuditInfoUnique; // Absolutely Unique ID
|
protected ContentAuditInfo()
|
||||||
}
|
{/* require use of factory methods */
|
||||||
#endregion
|
AddToCache(this);
|
||||||
#region Factory Methods
|
}
|
||||||
private static int _ContentAuditInfoUnique = 0;
|
private bool _Disposed = false;
|
||||||
private static int ContentAuditInfoUnique
|
private static int _CountCreated = 0;
|
||||||
{ get { return ++_ContentAuditInfoUnique; } }
|
private static int _CountDisposed = 0;
|
||||||
private int _MyContentAuditInfoUnique = ContentAuditInfoUnique;
|
private static int _CountFinalized = 0;
|
||||||
public int MyContentAuditInfoUnique // Absolutely Unique ID - Info
|
private static int IncrementCountCreated
|
||||||
{ get { return _MyContentAuditInfoUnique; } }
|
{ get { return ++_CountCreated; } }
|
||||||
protected ContentAuditInfo()
|
private int _CountWhenCreated = IncrementCountCreated;
|
||||||
{/* require use of factory methods */
|
public static int CountCreated
|
||||||
AddToCache(this);
|
{ get { return _CountCreated; } }
|
||||||
}
|
public static int CountNotDisposed
|
||||||
private bool _Disposed = false;
|
{ get { return _CountCreated - _CountDisposed; } }
|
||||||
private static int _CountCreated = 0;
|
public static int CountNotFinalized
|
||||||
private static int _CountDisposed = 0;
|
{ get { return _CountCreated - _CountFinalized; } }
|
||||||
private static int _CountFinalized = 0;
|
~ContentAuditInfo()
|
||||||
private static int IncrementCountCreated
|
{
|
||||||
{ get { return ++_CountCreated; } }
|
_CountFinalized++;
|
||||||
private int _CountWhenCreated = IncrementCountCreated;
|
}
|
||||||
public static int CountCreated
|
public void Dispose()
|
||||||
{ get { return _CountCreated; } }
|
{
|
||||||
public static int CountNotDisposed
|
if (_Disposed) return;
|
||||||
{ get { return _CountCreated - _CountDisposed; } }
|
_CountDisposed++;
|
||||||
public static int CountNotFinalized
|
_Disposed = true;
|
||||||
{ get { return _CountCreated - _CountFinalized; } }
|
RemoveFromCache(this);
|
||||||
~ContentAuditInfo()
|
if (!_CacheByPrimaryKey.ContainsKey(AuditID.ToString())) return;
|
||||||
{
|
List<ContentAuditInfo> listContentAuditInfo = _CacheByPrimaryKey[AuditID.ToString()]; // Get the list of items
|
||||||
_CountFinalized++;
|
while (listContentAuditInfo.Contains(this)) listContentAuditInfo.Remove(this); // Remove the item from the list
|
||||||
}
|
if (listContentAuditInfo.Count == 0) // If there are no items left in the list
|
||||||
public void Dispose()
|
_CacheByPrimaryKey.Remove(AuditID.ToString()); // remove the list
|
||||||
{
|
}
|
||||||
if (_Disposed) return;
|
public virtual ContentAudit Get()
|
||||||
_CountDisposed++;
|
{
|
||||||
_Disposed = true;
|
return _Editable = ContentAudit.Get(_AuditID);
|
||||||
RemoveFromCache(this);
|
}
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(AuditID.ToString())) return;
|
public static void Refresh(ContentAudit tmp)
|
||||||
List<ContentAuditInfo> listContentAuditInfo = _CacheByPrimaryKey[AuditID.ToString()]; // Get the list of items
|
{
|
||||||
while (listContentAuditInfo.Contains(this)) listContentAuditInfo.Remove(this); // Remove the item from the list
|
string key = tmp.AuditID.ToString();
|
||||||
if (listContentAuditInfo.Count == 0) // If there are no items left in the list
|
ConvertListToDictionary();
|
||||||
_CacheByPrimaryKey.Remove(AuditID.ToString()); // remove the list
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
}
|
foreach (ContentAuditInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
public virtual ContentAudit Get()
|
tmpInfo.RefreshFields(tmp);
|
||||||
{
|
}
|
||||||
return _Editable = ContentAudit.Get(_AuditID);
|
protected virtual void RefreshFields(ContentAudit tmp)
|
||||||
}
|
{
|
||||||
public static void Refresh(ContentAudit tmp)
|
_ContentID = tmp.ContentID;
|
||||||
{
|
_Number = tmp.Number;
|
||||||
string key = tmp.AuditID.ToString();
|
_Text = tmp.Text;
|
||||||
ConvertListToDictionary();
|
_Type = tmp.Type;
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
_FormatID = tmp.FormatID;
|
||||||
foreach (ContentAuditInfo tmpInfo in _CacheByPrimaryKey[key])
|
_Config = tmp.Config;
|
||||||
tmpInfo.RefreshFields(tmp);
|
_DTS = tmp.DTS;
|
||||||
}
|
_UserID = tmp.UserID;
|
||||||
protected virtual void RefreshFields(ContentAudit tmp)
|
_DeleteStatus = tmp.DeleteStatus;
|
||||||
{
|
_ContentAuditInfoExtension.Refresh(this);
|
||||||
_ContentID = tmp.ContentID;
|
OnChange();// raise an event
|
||||||
_Number = tmp.Number;
|
}
|
||||||
_Text = tmp.Text;
|
public static ContentAuditInfo Get(long auditID)
|
||||||
_Type = tmp.Type;
|
{
|
||||||
_FormatID = tmp.FormatID;
|
//if (!CanGetObject())
|
||||||
_Config = tmp.Config;
|
// throw new System.Security.SecurityException("User not authorized to view a ContentAudit");
|
||||||
_DTS = tmp.DTS;
|
try
|
||||||
_UserID = tmp.UserID;
|
{
|
||||||
_DeleteStatus = tmp.DeleteStatus;
|
ContentAuditInfo tmp = GetCachedByPrimaryKey(auditID);
|
||||||
_ContentAuditInfoExtension.Refresh(this);
|
if (tmp == null)
|
||||||
OnChange();// raise an event
|
{
|
||||||
}
|
tmp = DataPortal.Fetch<ContentAuditInfo>(new PKCriteria(auditID));
|
||||||
public static ContentAuditInfo Get(long auditID)
|
AddToCache(tmp);
|
||||||
{
|
}
|
||||||
//if (!CanGetObject())
|
if (tmp.ErrorMessage == "No Record Found")
|
||||||
// throw new System.Security.SecurityException("User not authorized to view a ContentAudit");
|
{
|
||||||
try
|
tmp.Dispose(); // Clean-up ContentAuditInfo
|
||||||
{
|
tmp = null;
|
||||||
ContentAuditInfo tmp = GetCachedByPrimaryKey(auditID);
|
}
|
||||||
if (tmp == null)
|
return tmp;
|
||||||
{
|
}
|
||||||
tmp = DataPortal.Fetch<ContentAuditInfo>(new PKCriteria(auditID));
|
catch (Exception ex)
|
||||||
AddToCache(tmp);
|
{
|
||||||
}
|
throw new DbCslaException("Error on ContentAuditInfo.Get", ex);
|
||||||
if (tmp.ErrorMessage == "No Record Found")
|
}
|
||||||
{
|
}
|
||||||
tmp.Dispose(); // Clean-up ContentAuditInfo
|
#endregion
|
||||||
tmp = null;
|
#region Data Access Portal
|
||||||
}
|
internal ContentAuditInfo(SafeDataReader dr)
|
||||||
return tmp;
|
{
|
||||||
}
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentAuditInfo.Constructor", GetHashCode());
|
||||||
catch (Exception ex)
|
try
|
||||||
{
|
{
|
||||||
throw new DbCslaException("Error on ContentAuditInfo.Get", ex);
|
ReadData(dr);
|
||||||
}
|
}
|
||||||
}
|
catch (Exception ex)
|
||||||
#endregion
|
{
|
||||||
#region Data Access Portal
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentAuditInfo.Constructor", ex);
|
||||||
internal ContentAuditInfo(SafeDataReader dr)
|
throw new DbCslaException("ContentAuditInfo.Constructor", ex);
|
||||||
{
|
}
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentAuditInfo.Constructor", GetHashCode());
|
}
|
||||||
try
|
[Serializable()]
|
||||||
{
|
protected class PKCriteria
|
||||||
ReadData(dr);
|
{
|
||||||
}
|
private long _AuditID;
|
||||||
catch (Exception ex)
|
public long AuditID
|
||||||
{
|
{ get { return _AuditID; } }
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentAuditInfo.Constructor", ex);
|
public PKCriteria(long auditID)
|
||||||
throw new DbCslaException("ContentAuditInfo.Constructor", ex);
|
{
|
||||||
}
|
_AuditID = auditID;
|
||||||
}
|
}
|
||||||
[Serializable()]
|
}
|
||||||
protected class PKCriteria
|
private void ReadData(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
private long _AuditID;
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentAuditInfo.ReadData", GetHashCode());
|
||||||
public long AuditID
|
try
|
||||||
{ get { return _AuditID; } }
|
{
|
||||||
public PKCriteria(long auditID)
|
_AuditID = dr.GetInt64("AuditID");
|
||||||
{
|
_ContentID = dr.GetInt32("ContentID");
|
||||||
_AuditID = auditID;
|
_Number = dr.GetString("Number");
|
||||||
}
|
_Text = dr.GetString("Text");
|
||||||
}
|
_Type = (int?)dr.GetValue("Type");
|
||||||
private void ReadData(SafeDataReader dr)
|
_FormatID = (int?)dr.GetValue("FormatID");
|
||||||
{
|
_Config = dr.GetString("Config");
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentAuditInfo.ReadData", GetHashCode());
|
_DTS = dr.GetDateTime("DTS");
|
||||||
try
|
_UserID = dr.GetString("UserID");
|
||||||
{
|
_DeleteStatus = dr.GetInt32("DeleteStatus");
|
||||||
_AuditID = dr.GetInt64("AuditID");
|
}
|
||||||
_ContentID = dr.GetInt32("ContentID");
|
catch (Exception ex)
|
||||||
_Number = dr.GetString("Number");
|
{
|
||||||
_Text = dr.GetString("Text");
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentAuditInfo.ReadData", ex);
|
||||||
_Type = (int?)dr.GetValue("Type");
|
_ErrorMessage = ex.Message;
|
||||||
_FormatID = (int?)dr.GetValue("FormatID");
|
throw new DbCslaException("ContentAuditInfo.ReadData", ex);
|
||||||
_Config = dr.GetString("Config");
|
}
|
||||||
_DTS = dr.GetDateTime("DTS");
|
}
|
||||||
_UserID = dr.GetString("UserID");
|
private void DataPortal_Fetch(PKCriteria criteria)
|
||||||
_DeleteStatus = dr.GetInt32("DeleteStatus");
|
{
|
||||||
}
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentAuditInfo.DataPortal_Fetch", GetHashCode());
|
||||||
catch (Exception ex)
|
try
|
||||||
{
|
{
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentAuditInfo.ReadData", ex);
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
_ErrorMessage = ex.Message;
|
{
|
||||||
throw new DbCslaException("ContentAuditInfo.ReadData", ex);
|
ApplicationContext.LocalContext["cn"] = cn;
|
||||||
}
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
}
|
{
|
||||||
private void DataPortal_Fetch(PKCriteria criteria)
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
{
|
cm.CommandText = "getContentAudit";
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentAuditInfo.DataPortal_Fetch", GetHashCode());
|
cm.Parameters.AddWithValue("@AuditID", criteria.AuditID);
|
||||||
try
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
{
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
{
|
||||||
{
|
if (!dr.Read())
|
||||||
ApplicationContext.LocalContext["cn"] = cn;
|
{
|
||||||
using (SqlCommand cm = cn.CreateCommand())
|
_ErrorMessage = "No Record Found";
|
||||||
{
|
return;
|
||||||
cm.CommandType = CommandType.StoredProcedure;
|
}
|
||||||
cm.CommandText = "getContentAudit";
|
ReadData(dr);
|
||||||
cm.Parameters.AddWithValue("@AuditID", criteria.AuditID);
|
}
|
||||||
cm.CommandTimeout = Database.DefaultTimeout;
|
}
|
||||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
// removing of item only needed for local data portal
|
||||||
{
|
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
||||||
if (!dr.Read())
|
ApplicationContext.LocalContext.Remove("cn");
|
||||||
{
|
}
|
||||||
_ErrorMessage = "No Record Found";
|
}
|
||||||
return;
|
catch (Exception ex)
|
||||||
}
|
{
|
||||||
ReadData(dr);
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentAuditInfo.DataPortal_Fetch", ex);
|
||||||
}
|
_ErrorMessage = ex.Message;
|
||||||
}
|
throw new DbCslaException("ContentAuditInfo.DataPortal_Fetch", ex);
|
||||||
// removing of item only needed for local data portal
|
}
|
||||||
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
}
|
||||||
ApplicationContext.LocalContext.Remove("cn");
|
#endregion
|
||||||
}
|
// Standard Refresh
|
||||||
}
|
#region extension
|
||||||
catch (Exception ex)
|
ContentAuditInfoExtension _ContentAuditInfoExtension = new ContentAuditInfoExtension();
|
||||||
{
|
[Serializable()]
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentAuditInfo.DataPortal_Fetch", ex);
|
partial class ContentAuditInfoExtension : extensionBase { }
|
||||||
_ErrorMessage = ex.Message;
|
[Serializable()]
|
||||||
throw new DbCslaException("ContentAuditInfo.DataPortal_Fetch", ex);
|
class extensionBase
|
||||||
}
|
{
|
||||||
}
|
// Default Refresh
|
||||||
#endregion
|
public virtual void Refresh(ContentAuditInfo tmp) { }
|
||||||
// Standard Refresh
|
}
|
||||||
#region extension
|
#endregion
|
||||||
ContentAuditInfoExtension _ContentAuditInfoExtension = new ContentAuditInfoExtension();
|
} // Class
|
||||||
[Serializable()]
|
#region Converter
|
||||||
partial class ContentAuditInfoExtension : extensionBase { }
|
internal class ContentAuditInfoConverter : ExpandableObjectConverter
|
||||||
[Serializable()]
|
{
|
||||||
class extensionBase
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
{
|
{
|
||||||
// Default Refresh
|
if (destType == typeof(string) && value is ContentAuditInfo)
|
||||||
public virtual void Refresh(ContentAuditInfo tmp) { }
|
{
|
||||||
}
|
// Return the ToString value
|
||||||
#endregion
|
return ((ContentAuditInfo)value).ToString();
|
||||||
} // Class
|
}
|
||||||
#region Converter
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
internal class ContentAuditInfoConverter : ExpandableObjectConverter
|
}
|
||||||
{
|
}
|
||||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
#endregion
|
||||||
{
|
|
||||||
if (destType == typeof(string) && value is ContentAuditInfo)
|
|
||||||
{
|
|
||||||
// Return the ToString value
|
|
||||||
return ((ContentAuditInfo)value).ToString();
|
|
||||||
}
|
|
||||||
return base.ConvertTo(context, culture, value, destType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
@ -20,456 +20,444 @@ using System.Collections.Generic;
|
|||||||
using Csla.Validation;
|
using Csla.Validation;
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ContentDetail Generated by MyGeneration using the CSLA Object Mapping template
|
/// ContentDetail Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
[TypeConverter(typeof(ContentDetailConverter))]
|
[TypeConverter(typeof(ContentDetailConverter))]
|
||||||
public partial class ContentDetail : BusinessBase<ContentDetail>, IVEHasBrokenRules, IDisposable
|
public partial class ContentDetail : BusinessBase<ContentDetail>, IVEHasBrokenRules, IDisposable
|
||||||
{
|
{
|
||||||
#region Log4Net
|
#region Log4Net
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#endregion
|
#endregion
|
||||||
#region Business Methods
|
#region Business Methods
|
||||||
private string _ErrorMessage = string.Empty;
|
private string _ErrorMessage = string.Empty;
|
||||||
public string ErrorMessage
|
public string ErrorMessage
|
||||||
{
|
{
|
||||||
get { return _ErrorMessage; }
|
get { return _ErrorMessage; }
|
||||||
}
|
}
|
||||||
private int _DetailID;
|
private int _DetailID;
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
public int DetailID
|
public int DetailID
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("DetailID", true);
|
if (_MyDetail != null) _DetailID = _MyDetail.DetailID;
|
||||||
if (_MyDetail != null) _DetailID = _MyDetail.DetailID;
|
return _DetailID;
|
||||||
return _DetailID;
|
}
|
||||||
}
|
}
|
||||||
}
|
private Detail _MyDetail;
|
||||||
private Detail _MyDetail;
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
public Detail MyDetail
|
||||||
public Detail MyDetail
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
get
|
||||||
get
|
{
|
||||||
{
|
if (_MyDetail == null && _DetailID != 0) _MyDetail = Detail.Get(_DetailID);
|
||||||
CanReadProperty("MyDetail", true);
|
return _MyDetail;
|
||||||
if (_MyDetail == null && _DetailID != 0) _MyDetail = Detail.Get(_DetailID);
|
}
|
||||||
return _MyDetail;
|
}
|
||||||
}
|
private int _ItemType;
|
||||||
}
|
public int ItemType
|
||||||
private int _ItemType;
|
{
|
||||||
public int ItemType
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
return _ItemType;
|
||||||
{
|
}
|
||||||
CanReadProperty("ItemType", true);
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
return _ItemType;
|
set
|
||||||
}
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
if (_ItemType != value)
|
||||||
set
|
{
|
||||||
{
|
_ItemType = value;
|
||||||
CanWriteProperty("ItemType", true);
|
PropertyHasChanged();
|
||||||
if (_ItemType != value)
|
}
|
||||||
{
|
}
|
||||||
_ItemType = value;
|
}
|
||||||
PropertyHasChanged();
|
private string _Text = string.Empty;
|
||||||
}
|
public string Text
|
||||||
}
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
private string _Text = string.Empty;
|
get
|
||||||
public string Text
|
{
|
||||||
{
|
return _Text;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
set
|
||||||
CanReadProperty("Text", true);
|
{
|
||||||
return _Text;
|
if (value == null) value = string.Empty;
|
||||||
}
|
if (_Text != value)
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
set
|
_Text = value;
|
||||||
{
|
PropertyHasChanged();
|
||||||
CanWriteProperty("Text", true);
|
}
|
||||||
if (value == null) value = string.Empty;
|
}
|
||||||
if (_Text != value)
|
}
|
||||||
{
|
private string _Config = string.Empty;
|
||||||
_Text = value;
|
public string Config
|
||||||
PropertyHasChanged();
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
}
|
{
|
||||||
private string _Config = string.Empty;
|
return _Config;
|
||||||
public string Config
|
}
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
set
|
||||||
get
|
{
|
||||||
{
|
if (value == null) value = string.Empty;
|
||||||
CanReadProperty("Config", true);
|
if (_Config != value)
|
||||||
return _Config;
|
{
|
||||||
}
|
_Config = value;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
PropertyHasChanged();
|
||||||
set
|
}
|
||||||
{
|
}
|
||||||
CanWriteProperty("Config", true);
|
}
|
||||||
if (value == null) value = string.Empty;
|
private DateTime _DTS = new DateTime();
|
||||||
if (_Config != value)
|
public DateTime DTS
|
||||||
{
|
{
|
||||||
_Config = value;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
PropertyHasChanged();
|
get
|
||||||
}
|
{
|
||||||
}
|
return _DTS;
|
||||||
}
|
}
|
||||||
private DateTime _DTS = new DateTime();
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
public DateTime DTS
|
set
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
if (_DTS != value)
|
||||||
get
|
{
|
||||||
{
|
_DTS = value;
|
||||||
CanReadProperty("DTS", true);
|
PropertyHasChanged();
|
||||||
return _DTS;
|
}
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
set
|
private string _UserID = string.Empty;
|
||||||
{
|
public string UserID
|
||||||
CanWriteProperty("DTS", true);
|
{
|
||||||
if (_DTS != value)
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
_DTS = value;
|
{
|
||||||
PropertyHasChanged();
|
return _UserID;
|
||||||
}
|
}
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
set
|
||||||
private string _UserID = string.Empty;
|
{
|
||||||
public string UserID
|
if (value == null) value = string.Empty;
|
||||||
{
|
if (_UserID != value)
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
_UserID = value;
|
||||||
{
|
PropertyHasChanged();
|
||||||
CanReadProperty("UserID", true);
|
}
|
||||||
return _UserID;
|
}
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
private byte[] _LastChanged = new byte[8];//timestamp
|
||||||
set
|
// CSLATODO: Check ContentDetail.GetIdValue to assure that the ID returned is unique
|
||||||
{
|
/// <summary>
|
||||||
CanWriteProperty("UserID", true);
|
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||||
if (value == null) value = string.Empty;
|
/// </summary>
|
||||||
if (_UserID != value)
|
/// <returns>A Unique ID for the current ContentDetail</returns>
|
||||||
{
|
protected override object GetIdValue()
|
||||||
_UserID = value;
|
{
|
||||||
PropertyHasChanged();
|
return MyContentDetailUnique; // Absolutely Unique ID
|
||||||
}
|
}
|
||||||
}
|
// CSLATODO: Replace base ContentDetail.ToString function as necessary
|
||||||
}
|
/// <summary>
|
||||||
private byte[] _LastChanged = new byte[8];//timestamp
|
/// Overrides Base ToString
|
||||||
// CSLATODO: Check ContentDetail.GetIdValue to assure that the ID returned is unique
|
/// </summary>
|
||||||
/// <summary>
|
/// <returns>A string representation of current ContentDetail</returns>
|
||||||
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
//public override string ToString()
|
||||||
/// </summary>
|
//{
|
||||||
/// <returns>A Unique ID for the current ContentDetail</returns>
|
// return base.ToString();
|
||||||
protected override object GetIdValue()
|
//}
|
||||||
{
|
public override bool IsDirty
|
||||||
return MyContentDetailUnique; // Absolutely Unique ID
|
{
|
||||||
}
|
get { return base.IsDirty; }
|
||||||
// CSLATODO: Replace base ContentDetail.ToString function as necessary
|
}
|
||||||
/// <summary>
|
public bool IsDirtyList(List<object> list)
|
||||||
/// Overrides Base ToString
|
{
|
||||||
/// </summary>
|
return base.IsDirty;
|
||||||
/// <returns>A string representation of current ContentDetail</returns>
|
}
|
||||||
//public override string ToString()
|
public override bool IsValid
|
||||||
//{
|
{
|
||||||
// return base.ToString();
|
get { return (IsNew && !IsDirty) ? true : base.IsValid; }
|
||||||
//}
|
}
|
||||||
public override bool IsDirty
|
public bool IsValidList(List<object> list)
|
||||||
{
|
{
|
||||||
get { return base.IsDirty; }
|
return (IsNew && !IsDirty) ? true : base.IsValid;
|
||||||
}
|
}
|
||||||
public bool IsDirtyList(List<object> list)
|
#endregion
|
||||||
{
|
#region ValidationRules
|
||||||
return base.IsDirty;
|
[NonSerialized]
|
||||||
}
|
private bool _CheckingBrokenRules = false;
|
||||||
public override bool IsValid
|
public IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get { return (IsNew && !IsDirty) ? true : base.IsValid; }
|
get
|
||||||
}
|
{
|
||||||
public bool IsValidList(List<object> list)
|
if (_CheckingBrokenRules) return null;
|
||||||
{
|
if (BrokenRulesCollection.Count > 0) return this;
|
||||||
return (IsNew && !IsDirty) ? true : base.IsValid;
|
try
|
||||||
}
|
{
|
||||||
#endregion
|
_CheckingBrokenRules = true;
|
||||||
#region ValidationRules
|
IVEHasBrokenRules hasBrokenRules = null;
|
||||||
[NonSerialized]
|
return hasBrokenRules;
|
||||||
private bool _CheckingBrokenRules = false;
|
}
|
||||||
public IVEHasBrokenRules HasBrokenRules
|
finally
|
||||||
{
|
{
|
||||||
get
|
_CheckingBrokenRules = false;
|
||||||
{
|
}
|
||||||
if (_CheckingBrokenRules) return null;
|
}
|
||||||
if (BrokenRulesCollection.Count > 0) return this;
|
}
|
||||||
try
|
public BrokenRulesCollection BrokenRules
|
||||||
{
|
{
|
||||||
_CheckingBrokenRules = true;
|
get
|
||||||
IVEHasBrokenRules hasBrokenRules = null;
|
{
|
||||||
return hasBrokenRules;
|
IVEHasBrokenRules hasBrokenRules = HasBrokenRules;
|
||||||
}
|
if (this.Equals(hasBrokenRules)) return BrokenRulesCollection;
|
||||||
finally
|
return (hasBrokenRules != null ? hasBrokenRules.BrokenRules : null);
|
||||||
{
|
}
|
||||||
_CheckingBrokenRules = false;
|
}
|
||||||
}
|
protected override void AddBusinessRules()
|
||||||
}
|
{
|
||||||
}
|
ValidationRules.AddRule(
|
||||||
public BrokenRulesCollection BrokenRules
|
Csla.Validation.CommonRules.StringRequired, "Text");
|
||||||
{
|
ValidationRules.AddRule(
|
||||||
get
|
Csla.Validation.CommonRules.StringMaxLength,
|
||||||
{
|
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Text", 1073741823));
|
||||||
IVEHasBrokenRules hasBrokenRules = HasBrokenRules;
|
ValidationRules.AddRule(
|
||||||
if (this.Equals(hasBrokenRules)) return BrokenRulesCollection;
|
Csla.Validation.CommonRules.StringMaxLength,
|
||||||
return (hasBrokenRules != null ? hasBrokenRules.BrokenRules : null);
|
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Config", 1073741823));
|
||||||
}
|
ValidationRules.AddRule(
|
||||||
}
|
Csla.Validation.CommonRules.StringRequired, "UserID");
|
||||||
protected override void AddBusinessRules()
|
ValidationRules.AddRule(
|
||||||
{
|
Csla.Validation.CommonRules.StringMaxLength,
|
||||||
ValidationRules.AddRule(
|
new Csla.Validation.CommonRules.MaxLengthRuleArgs("UserID", 100));
|
||||||
Csla.Validation.CommonRules.StringRequired, "Text");
|
// CSLATODO: Add other validation rules
|
||||||
ValidationRules.AddRule(
|
}
|
||||||
Csla.Validation.CommonRules.StringMaxLength,
|
// Sample data comparison validation rule
|
||||||
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Text", 1073741823));
|
//private bool StartDateGTEndDate(object target, Csla.Validation.RuleArgs e)
|
||||||
ValidationRules.AddRule(
|
//{
|
||||||
Csla.Validation.CommonRules.StringMaxLength,
|
// if (_started > _ended)
|
||||||
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Config", 1073741823));
|
// {
|
||||||
ValidationRules.AddRule(
|
// e.Description = "Start date can't be after end date";
|
||||||
Csla.Validation.CommonRules.StringRequired, "UserID");
|
// return false;
|
||||||
ValidationRules.AddRule(
|
// }
|
||||||
Csla.Validation.CommonRules.StringMaxLength,
|
// else
|
||||||
new Csla.Validation.CommonRules.MaxLengthRuleArgs("UserID", 100));
|
// return true;
|
||||||
// CSLATODO: Add other validation rules
|
//}
|
||||||
}
|
#endregion
|
||||||
// Sample data comparison validation rule
|
#region Authorization Rules
|
||||||
//private bool StartDateGTEndDate(object target, Csla.Validation.RuleArgs e)
|
protected override void AddAuthorizationRules()
|
||||||
//{
|
{
|
||||||
// if (_started > _ended)
|
//CSLATODO: Who can read/write which fields
|
||||||
// {
|
//AuthorizationRules.AllowRead(DetailID, "<Role(s)>");
|
||||||
// e.Description = "Start date can't be after end date";
|
//AuthorizationRules.AllowRead(ItemType, "<Role(s)>");
|
||||||
// return false;
|
//AuthorizationRules.AllowWrite(ItemType, "<Role(s)>");
|
||||||
// }
|
//AuthorizationRules.AllowRead(Text, "<Role(s)>");
|
||||||
// else
|
//AuthorizationRules.AllowWrite(Text, "<Role(s)>");
|
||||||
// return true;
|
//AuthorizationRules.AllowRead(Config, "<Role(s)>");
|
||||||
//}
|
//AuthorizationRules.AllowWrite(Config, "<Role(s)>");
|
||||||
#endregion
|
//AuthorizationRules.AllowRead(DTS, "<Role(s)>");
|
||||||
#region Authorization Rules
|
//AuthorizationRules.AllowWrite(DTS, "<Role(s)>");
|
||||||
protected override void AddAuthorizationRules()
|
//AuthorizationRules.AllowRead(UserID, "<Role(s)>");
|
||||||
{
|
//AuthorizationRules.AllowWrite(UserID, "<Role(s)>");
|
||||||
//CSLATODO: Who can read/write which fields
|
}
|
||||||
//AuthorizationRules.AllowRead(DetailID, "<Role(s)>");
|
public static bool CanAddObject()
|
||||||
//AuthorizationRules.AllowRead(ItemType, "<Role(s)>");
|
{
|
||||||
//AuthorizationRules.AllowWrite(ItemType, "<Role(s)>");
|
// CSLATODO: Can Add Authorization
|
||||||
//AuthorizationRules.AllowRead(Text, "<Role(s)>");
|
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
|
||||||
//AuthorizationRules.AllowWrite(Text, "<Role(s)>");
|
return true;
|
||||||
//AuthorizationRules.AllowRead(Config, "<Role(s)>");
|
}
|
||||||
//AuthorizationRules.AllowWrite(Config, "<Role(s)>");
|
public static bool CanGetObject()
|
||||||
//AuthorizationRules.AllowRead(DTS, "<Role(s)>");
|
{
|
||||||
//AuthorizationRules.AllowWrite(DTS, "<Role(s)>");
|
// CSLATODO: CanGet Authorization
|
||||||
//AuthorizationRules.AllowRead(UserID, "<Role(s)>");
|
return true;
|
||||||
//AuthorizationRules.AllowWrite(UserID, "<Role(s)>");
|
}
|
||||||
}
|
public static bool CanDeleteObject()
|
||||||
public static bool CanAddObject()
|
{
|
||||||
{
|
// CSLATODO: CanDelete Authorization
|
||||||
// CSLATODO: Can Add Authorization
|
//bool result = false;
|
||||||
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
|
//if (Csla.ApplicationContext.User.IsInRole("ProjectManager"))result = true;
|
||||||
return true;
|
//if (Csla.ApplicationContext.User.IsInRole("Administrator"))result = true;
|
||||||
}
|
//return result;
|
||||||
public static bool CanGetObject()
|
return true;
|
||||||
{
|
}
|
||||||
// CSLATODO: CanGet Authorization
|
public static bool CanEditObject()
|
||||||
return true;
|
{
|
||||||
}
|
// CSLATODO: CanEdit Authorization
|
||||||
public static bool CanDeleteObject()
|
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
|
||||||
{
|
return true;
|
||||||
// CSLATODO: CanDelete Authorization
|
}
|
||||||
//bool result = false;
|
#endregion
|
||||||
//if (Csla.ApplicationContext.User.IsInRole("ProjectManager"))result = true;
|
#region Factory Methods
|
||||||
//if (Csla.ApplicationContext.User.IsInRole("Administrator"))result = true;
|
public int CurrentEditLevel
|
||||||
//return result;
|
{ get { return EditLevel; } }
|
||||||
return true;
|
private static int _ContentDetailUnique = 0;
|
||||||
}
|
private static int ContentDetailUnique
|
||||||
public static bool CanEditObject()
|
{ get { return ++_ContentDetailUnique; } }
|
||||||
{
|
private int _MyContentDetailUnique = ContentDetailUnique;
|
||||||
// CSLATODO: CanEdit Authorization
|
public int MyContentDetailUnique // Absolutely Unique ID - Editable FK
|
||||||
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
|
{ get { return _MyContentDetailUnique; } }
|
||||||
return true;
|
internal static ContentDetail New(int itemType, string text)
|
||||||
}
|
{
|
||||||
#endregion
|
return new ContentDetail(itemType, text);
|
||||||
#region Factory Methods
|
}
|
||||||
public int CurrentEditLevel
|
internal static ContentDetail Get(SafeDataReader dr)
|
||||||
{ get { return EditLevel; } }
|
{
|
||||||
private static int _ContentDetailUnique = 0;
|
return new ContentDetail(dr);
|
||||||
private static int ContentDetailUnique
|
}
|
||||||
{ get { return ++_ContentDetailUnique; } }
|
public ContentDetail()
|
||||||
private int _MyContentDetailUnique = ContentDetailUnique;
|
{
|
||||||
public int MyContentDetailUnique // Absolutely Unique ID - Editable FK
|
MarkAsChild();
|
||||||
{ get { return _MyContentDetailUnique; } }
|
_DetailID = Detail.NextDetailID;
|
||||||
internal static ContentDetail New(int itemType, string text)
|
_DTS = _ContentDetailExtension.DefaultDTS;
|
||||||
{
|
_UserID = _ContentDetailExtension.DefaultUserID;
|
||||||
return new ContentDetail(itemType, text);
|
ValidationRules.CheckRules();
|
||||||
}
|
}
|
||||||
internal static ContentDetail Get(SafeDataReader dr)
|
private ContentDetail(int itemType, string text)
|
||||||
{
|
{
|
||||||
return new ContentDetail(dr);
|
MarkAsChild();
|
||||||
}
|
// CSLATODO: Add any initialization & defaults
|
||||||
public ContentDetail()
|
_DetailID = Detail.NextDetailID;
|
||||||
{
|
_DTS = _ContentDetailExtension.DefaultDTS;
|
||||||
MarkAsChild();
|
_UserID = _ContentDetailExtension.DefaultUserID;
|
||||||
_DetailID = Detail.NextDetailID;
|
_ItemType = itemType;
|
||||||
_DTS = _ContentDetailExtension.DefaultDTS;
|
_Text = text;
|
||||||
_UserID = _ContentDetailExtension.DefaultUserID;
|
ValidationRules.CheckRules();
|
||||||
ValidationRules.CheckRules();
|
}
|
||||||
}
|
internal ContentDetail(SafeDataReader dr)
|
||||||
private ContentDetail(int itemType, string text)
|
{
|
||||||
{
|
MarkAsChild();
|
||||||
MarkAsChild();
|
Fetch(dr);
|
||||||
// CSLATODO: Add any initialization & defaults
|
}
|
||||||
_DetailID = Detail.NextDetailID;
|
private bool _Disposed = false;
|
||||||
_DTS = _ContentDetailExtension.DefaultDTS;
|
private static int _CountCreated = 0;
|
||||||
_UserID = _ContentDetailExtension.DefaultUserID;
|
private static int _CountDisposed = 0;
|
||||||
_ItemType = itemType;
|
private static int _CountFinalized = 0;
|
||||||
_Text = text;
|
private static int IncrementCountCreated
|
||||||
ValidationRules.CheckRules();
|
{ get { return ++_CountCreated; } }
|
||||||
}
|
private int _CountWhenCreated = IncrementCountCreated;
|
||||||
internal ContentDetail(SafeDataReader dr)
|
public static int CountCreated
|
||||||
{
|
{ get { return _CountCreated; } }
|
||||||
MarkAsChild();
|
public static int CountNotDisposed
|
||||||
Fetch(dr);
|
{ get { return _CountCreated - _CountDisposed; } }
|
||||||
}
|
public static int CountNotFinalized
|
||||||
private bool _Disposed = false;
|
{ get { return _CountCreated - _CountFinalized; } }
|
||||||
private static int _CountCreated = 0;
|
~ContentDetail()
|
||||||
private static int _CountDisposed = 0;
|
{
|
||||||
private static int _CountFinalized = 0;
|
_CountFinalized++;
|
||||||
private static int IncrementCountCreated
|
}
|
||||||
{ get { return ++_CountCreated; } }
|
public void Dispose()
|
||||||
private int _CountWhenCreated = IncrementCountCreated;
|
{
|
||||||
public static int CountCreated
|
if (_Disposed) return;
|
||||||
{ get { return _CountCreated; } }
|
_CountDisposed++;
|
||||||
public static int CountNotDisposed
|
_Disposed = true;
|
||||||
{ get { return _CountCreated - _CountDisposed; } }
|
}
|
||||||
public static int CountNotFinalized
|
#endregion
|
||||||
{ get { return _CountCreated - _CountFinalized; } }
|
#region Data Access Portal
|
||||||
~ContentDetail()
|
private void Fetch(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
_CountFinalized++;
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentDetail.FetchDR", GetHashCode());
|
||||||
}
|
try
|
||||||
public void Dispose()
|
{
|
||||||
{
|
_DetailID = dr.GetInt32("DetailID");
|
||||||
if (_Disposed) return;
|
_ItemType = dr.GetInt32("ItemType");
|
||||||
_CountDisposed++;
|
_Text = dr.GetString("Text");
|
||||||
_Disposed = true;
|
_Config = dr.GetString("Config");
|
||||||
}
|
_DTS = dr.GetDateTime("DTS");
|
||||||
#endregion
|
_UserID = dr.GetString("UserID");
|
||||||
#region Data Access Portal
|
dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
|
||||||
private void Fetch(SafeDataReader dr)
|
}
|
||||||
{
|
catch (Exception ex) // FKItem Fetch
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentDetail.FetchDR", GetHashCode());
|
{
|
||||||
try
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentDetail.FetchDR", ex);
|
||||||
{
|
throw new DbCslaException("ContentDetail.Fetch", ex);
|
||||||
_DetailID = dr.GetInt32("DetailID");
|
}
|
||||||
_ItemType = dr.GetInt32("ItemType");
|
MarkOld();
|
||||||
_Text = dr.GetString("Text");
|
}
|
||||||
_Config = dr.GetString("Config");
|
internal void Insert(Content myContent)
|
||||||
_DTS = dr.GetDateTime("DTS");
|
{
|
||||||
_UserID = dr.GetString("UserID");
|
// if we're not dirty then don't update the database
|
||||||
dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
|
if (!this.IsDirty) return;
|
||||||
}
|
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||||
catch (Exception ex) // FKItem Fetch
|
_LastChanged = Detail.Add(cn, ref _DetailID, myContent, _ItemType, _Text, _Config, _DTS, _UserID);
|
||||||
{
|
MarkOld();
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentDetail.FetchDR", ex);
|
}
|
||||||
throw new DbCslaException("ContentDetail.Fetch", ex);
|
internal void Update(Content myContent)
|
||||||
}
|
{
|
||||||
MarkOld();
|
// if we're not dirty then don't update the database
|
||||||
}
|
if (!this.IsDirty) return;
|
||||||
internal void Insert(Content myContent)
|
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||||
{
|
_LastChanged = Detail.Update(cn, ref _DetailID, myContent.ContentID, _ItemType, _Text, _Config, _DTS, _UserID, ref _LastChanged);
|
||||||
// if we're not dirty then don't update the database
|
MarkOld();
|
||||||
if (!this.IsDirty) return;
|
}
|
||||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
internal void DeleteSelf(Content myContent)
|
||||||
_LastChanged = Detail.Add(cn, ref _DetailID, myContent, _ItemType, _Text, _Config, _DTS, _UserID);
|
{
|
||||||
MarkOld();
|
// if we're not dirty then don't update the database
|
||||||
}
|
if (!this.IsDirty) return;
|
||||||
internal void Update(Content myContent)
|
// if we're new then don't update the database
|
||||||
{
|
if (this.IsNew) return;
|
||||||
// if we're not dirty then don't update the database
|
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||||
if (!this.IsDirty) return;
|
Detail.Remove(cn, _DetailID);
|
||||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
MarkNew();
|
||||||
_LastChanged = Detail.Update(cn, ref _DetailID, myContent.ContentID, _ItemType, _Text, _Config, _DTS, _UserID, ref _LastChanged);
|
}
|
||||||
MarkOld();
|
#endregion
|
||||||
}
|
// Standard Default Code
|
||||||
internal void DeleteSelf(Content myContent)
|
#region extension
|
||||||
{
|
ContentDetailExtension _ContentDetailExtension = new ContentDetailExtension();
|
||||||
// if we're not dirty then don't update the database
|
[Serializable()]
|
||||||
if (!this.IsDirty) return;
|
partial class ContentDetailExtension : extensionBase
|
||||||
// if we're new then don't update the database
|
{
|
||||||
if (this.IsNew) return;
|
}
|
||||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
[Serializable()]
|
||||||
Detail.Remove(cn, _DetailID);
|
class extensionBase
|
||||||
MarkNew();
|
{
|
||||||
}
|
// Default Values
|
||||||
#endregion
|
public virtual DateTime DefaultDTS
|
||||||
// Standard Default Code
|
{
|
||||||
#region extension
|
get { return DateTime.Now; }
|
||||||
ContentDetailExtension _ContentDetailExtension = new ContentDetailExtension();
|
}
|
||||||
[Serializable()]
|
public virtual string DefaultUserID
|
||||||
partial class ContentDetailExtension : extensionBase
|
{
|
||||||
{
|
get { return Volian.Base.Library.VlnSettings.UserID; }
|
||||||
}
|
}
|
||||||
[Serializable()]
|
// Authorization Rules
|
||||||
class extensionBase
|
public virtual void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
|
||||||
{
|
{
|
||||||
// Default Values
|
// Needs to be overriden to add new authorization rules
|
||||||
public virtual DateTime DefaultDTS
|
}
|
||||||
{
|
// Instance Authorization Rules
|
||||||
get { return DateTime.Now; }
|
public virtual void AddInstanceAuthorizationRules(Csla.Security.AuthorizationRules rules)
|
||||||
}
|
{
|
||||||
public virtual string DefaultUserID
|
// Needs to be overriden to add new authorization rules
|
||||||
{
|
}
|
||||||
get { return Volian.Base.Library.VlnSettings.UserID; }
|
// Validation Rules
|
||||||
}
|
public virtual void AddValidationRules(Csla.Validation.ValidationRules rules)
|
||||||
// Authorization Rules
|
{
|
||||||
public virtual void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
|
// Needs to be overriden to add new validation rules
|
||||||
{
|
}
|
||||||
// Needs to be overriden to add new authorization rules
|
// InstanceValidation Rules
|
||||||
}
|
public virtual void AddInstanceValidationRules(Csla.Validation.ValidationRules rules)
|
||||||
// Instance Authorization Rules
|
{
|
||||||
public virtual void AddInstanceAuthorizationRules(Csla.Security.AuthorizationRules rules)
|
// Needs to be overriden to add new validation rules
|
||||||
{
|
}
|
||||||
// Needs to be overriden to add new authorization rules
|
}
|
||||||
}
|
#endregion
|
||||||
// Validation Rules
|
} // Class
|
||||||
public virtual void AddValidationRules(Csla.Validation.ValidationRules rules)
|
#region Converter
|
||||||
{
|
internal class ContentDetailConverter : ExpandableObjectConverter
|
||||||
// Needs to be overriden to add new validation rules
|
{
|
||||||
}
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
// InstanceValidation Rules
|
{
|
||||||
public virtual void AddInstanceValidationRules(Csla.Validation.ValidationRules rules)
|
if (destType == typeof(string) && value is ContentDetail)
|
||||||
{
|
{
|
||||||
// Needs to be overriden to add new validation rules
|
// Return the ToString value
|
||||||
}
|
return ((ContentDetail)value).ToString();
|
||||||
}
|
}
|
||||||
#endregion
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
} // Class
|
}
|
||||||
#region Converter
|
}
|
||||||
internal class ContentDetailConverter : ExpandableObjectConverter
|
#endregion
|
||||||
{
|
|
||||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
|
||||||
{
|
|
||||||
if (destType == typeof(string) && value is ContentDetail)
|
|
||||||
{
|
|
||||||
// Return the ToString value
|
|
||||||
return ((ContentDetail)value).ToString();
|
|
||||||
}
|
|
||||||
return base.ConvertTo(context, culture, value, destType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -20,403 +20,394 @@ using System.Collections.Generic;
|
|||||||
using Csla.Validation;
|
using Csla.Validation;
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ContentItem Generated by MyGeneration using the CSLA Object Mapping template
|
/// ContentItem Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
[TypeConverter(typeof(ContentItemConverter))]
|
[TypeConverter(typeof(ContentItemConverter))]
|
||||||
public partial class ContentItem : BusinessBase<ContentItem>, IVEHasBrokenRules, IDisposable
|
public partial class ContentItem : BusinessBase<ContentItem>, IVEHasBrokenRules, IDisposable
|
||||||
{
|
{
|
||||||
#region Log4Net
|
#region Log4Net
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#endregion
|
#endregion
|
||||||
#region Business Methods
|
#region Business Methods
|
||||||
private string _ErrorMessage = string.Empty;
|
private string _ErrorMessage = string.Empty;
|
||||||
public string ErrorMessage
|
public string ErrorMessage
|
||||||
{
|
{
|
||||||
get { return _ErrorMessage; }
|
get { return _ErrorMessage; }
|
||||||
}
|
}
|
||||||
private int _ItemID;
|
private int _ItemID;
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
public int ItemID
|
public int ItemID
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("ItemID", true);
|
if (_MyItem != null) _ItemID = _MyItem.ItemID;
|
||||||
if (_MyItem != null) _ItemID = _MyItem.ItemID;
|
return _ItemID;
|
||||||
return _ItemID;
|
}
|
||||||
}
|
}
|
||||||
}
|
private Item _MyItem;
|
||||||
private Item _MyItem;
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
public Item MyItem
|
||||||
public Item MyItem
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
get
|
||||||
get
|
{
|
||||||
{
|
if (_MyItem == null && _ItemID != 0) _MyItem = Item.Get(_ItemID);
|
||||||
CanReadProperty("MyItem", true);
|
return _MyItem;
|
||||||
if (_MyItem == null && _ItemID != 0) _MyItem = Item.Get(_ItemID);
|
}
|
||||||
return _MyItem;
|
}
|
||||||
}
|
private int? _PreviousID;
|
||||||
}
|
public int? PreviousID
|
||||||
private int? _PreviousID;
|
{
|
||||||
public int? PreviousID
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
if (_MyPrevious != null) _PreviousID = _MyPrevious.ItemID;
|
||||||
{
|
return _PreviousID;
|
||||||
CanReadProperty("PreviousID", true);
|
}
|
||||||
if (_MyPrevious != null) _PreviousID = _MyPrevious.ItemID;
|
}
|
||||||
return _PreviousID;
|
private Item _MyPrevious;
|
||||||
}
|
public Item MyPrevious
|
||||||
}
|
{
|
||||||
private Item _MyPrevious;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
public Item MyPrevious
|
get
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
if (_MyPrevious == null && _PreviousID != null) _MyPrevious = Item.Get((int)_PreviousID);
|
||||||
get
|
return _MyPrevious;
|
||||||
{
|
}
|
||||||
CanReadProperty("MyPrevious", true);
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
if (_MyPrevious == null && _PreviousID != null) _MyPrevious = Item.Get((int)_PreviousID);
|
set
|
||||||
return _MyPrevious;
|
{
|
||||||
}
|
if ((_MyPrevious == null ? _PreviousID : (int?)_MyPrevious.ItemID) != (value == null ? null : (int?)value.ItemID))
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
set
|
_MyPrevious = value;
|
||||||
{
|
_PreviousID = (value == null ? null : (int?)value.ItemID);
|
||||||
CanWriteProperty("MyPrevious", true);
|
PropertyHasChanged();
|
||||||
if ((_MyPrevious == null ? _PreviousID : (int?)_MyPrevious.ItemID) != (value == null ? null : (int?)value.ItemID))
|
}
|
||||||
{
|
}
|
||||||
_MyPrevious = value;
|
}
|
||||||
_PreviousID = (value == null ? null : (int?)value.ItemID);
|
private DateTime _DTS = new DateTime();
|
||||||
PropertyHasChanged();
|
public DateTime DTS
|
||||||
}
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
private DateTime _DTS = new DateTime();
|
{
|
||||||
public DateTime DTS
|
return _DTS;
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
set
|
||||||
{
|
{
|
||||||
CanReadProperty("DTS", true);
|
if (_DTS != value)
|
||||||
return _DTS;
|
{
|
||||||
}
|
_DTS = value;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
PropertyHasChanged();
|
||||||
set
|
}
|
||||||
{
|
}
|
||||||
CanWriteProperty("DTS", true);
|
}
|
||||||
if (_DTS != value)
|
private string _UserID = string.Empty;
|
||||||
{
|
public string UserID
|
||||||
_DTS = value;
|
{
|
||||||
PropertyHasChanged();
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
}
|
{
|
||||||
}
|
return _UserID;
|
||||||
private string _UserID = string.Empty;
|
}
|
||||||
public string UserID
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
set
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
if (value == null) value = string.Empty;
|
||||||
{
|
if (_UserID != value)
|
||||||
CanReadProperty("UserID", true);
|
{
|
||||||
return _UserID;
|
_UserID = value;
|
||||||
}
|
PropertyHasChanged();
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
set
|
}
|
||||||
{
|
}
|
||||||
CanWriteProperty("UserID", true);
|
private byte[] _LastChanged = new byte[8];//timestamp
|
||||||
if (value == null) value = string.Empty;
|
// CSLATODO: Check ContentItem.GetIdValue to assure that the ID returned is unique
|
||||||
if (_UserID != value)
|
/// <summary>
|
||||||
{
|
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||||
_UserID = value;
|
/// </summary>
|
||||||
PropertyHasChanged();
|
/// <returns>A Unique ID for the current ContentItem</returns>
|
||||||
}
|
protected override object GetIdValue()
|
||||||
}
|
{
|
||||||
}
|
return MyContentItemUnique; // Absolutely Unique ID
|
||||||
private byte[] _LastChanged = new byte[8];//timestamp
|
}
|
||||||
// CSLATODO: Check ContentItem.GetIdValue to assure that the ID returned is unique
|
// CSLATODO: Replace base ContentItem.ToString function as necessary
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
/// Overrides Base ToString
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>A Unique ID for the current ContentItem</returns>
|
/// <returns>A string representation of current ContentItem</returns>
|
||||||
protected override object GetIdValue()
|
//public override string ToString()
|
||||||
{
|
//{
|
||||||
return MyContentItemUnique; // Absolutely Unique ID
|
// return base.ToString();
|
||||||
}
|
//}
|
||||||
// CSLATODO: Replace base ContentItem.ToString function as necessary
|
public override bool IsDirty
|
||||||
/// <summary>
|
{
|
||||||
/// Overrides Base ToString
|
get { return base.IsDirty; }
|
||||||
/// </summary>
|
}
|
||||||
/// <returns>A string representation of current ContentItem</returns>
|
public bool IsDirtyList(List<object> list)
|
||||||
//public override string ToString()
|
{
|
||||||
//{
|
return base.IsDirty;
|
||||||
// return base.ToString();
|
}
|
||||||
//}
|
public override bool IsValid
|
||||||
public override bool IsDirty
|
{
|
||||||
{
|
get { return (IsNew && !IsDirty) ? true : base.IsValid; }
|
||||||
get { return base.IsDirty; }
|
}
|
||||||
}
|
public bool IsValidList(List<object> list)
|
||||||
public bool IsDirtyList(List<object> list)
|
{
|
||||||
{
|
return (IsNew && !IsDirty) ? true : base.IsValid;
|
||||||
return base.IsDirty;
|
}
|
||||||
}
|
#endregion
|
||||||
public override bool IsValid
|
#region ValidationRules
|
||||||
{
|
[NonSerialized]
|
||||||
get { return (IsNew && !IsDirty) ? true : base.IsValid; }
|
private bool _CheckingBrokenRules = false;
|
||||||
}
|
public IVEHasBrokenRules HasBrokenRules
|
||||||
public bool IsValidList(List<object> list)
|
{
|
||||||
{
|
get
|
||||||
return (IsNew && !IsDirty) ? true : base.IsValid;
|
{
|
||||||
}
|
if (_CheckingBrokenRules) return null;
|
||||||
#endregion
|
if (BrokenRulesCollection.Count > 0) return this;
|
||||||
#region ValidationRules
|
try
|
||||||
[NonSerialized]
|
{
|
||||||
private bool _CheckingBrokenRules = false;
|
_CheckingBrokenRules = true;
|
||||||
public IVEHasBrokenRules HasBrokenRules
|
IVEHasBrokenRules hasBrokenRules = null;
|
||||||
{
|
if (_MyItem != null && (hasBrokenRules = _MyItem.HasBrokenRules) != null) return hasBrokenRules;
|
||||||
get
|
return hasBrokenRules;
|
||||||
{
|
}
|
||||||
if (_CheckingBrokenRules) return null;
|
finally
|
||||||
if (BrokenRulesCollection.Count > 0) return this;
|
{
|
||||||
try
|
_CheckingBrokenRules = false;
|
||||||
{
|
}
|
||||||
_CheckingBrokenRules = true;
|
}
|
||||||
IVEHasBrokenRules hasBrokenRules = null;
|
}
|
||||||
if (_MyItem != null && (hasBrokenRules = _MyItem.HasBrokenRules) != null) return hasBrokenRules;
|
public BrokenRulesCollection BrokenRules
|
||||||
return hasBrokenRules;
|
{
|
||||||
}
|
get
|
||||||
finally
|
{
|
||||||
{
|
IVEHasBrokenRules hasBrokenRules = HasBrokenRules;
|
||||||
_CheckingBrokenRules = false;
|
if (this.Equals(hasBrokenRules)) return BrokenRulesCollection;
|
||||||
}
|
return (hasBrokenRules != null ? hasBrokenRules.BrokenRules : null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public BrokenRulesCollection BrokenRules
|
protected override void AddBusinessRules()
|
||||||
{
|
{
|
||||||
get
|
ValidationRules.AddRule(
|
||||||
{
|
Csla.Validation.CommonRules.StringRequired, "UserID");
|
||||||
IVEHasBrokenRules hasBrokenRules = HasBrokenRules;
|
ValidationRules.AddRule(
|
||||||
if (this.Equals(hasBrokenRules)) return BrokenRulesCollection;
|
Csla.Validation.CommonRules.StringMaxLength,
|
||||||
return (hasBrokenRules != null ? hasBrokenRules.BrokenRules : null);
|
new Csla.Validation.CommonRules.MaxLengthRuleArgs("UserID", 100));
|
||||||
}
|
// CSLATODO: Add other validation rules
|
||||||
}
|
}
|
||||||
protected override void AddBusinessRules()
|
// Sample data comparison validation rule
|
||||||
{
|
//private bool StartDateGTEndDate(object target, Csla.Validation.RuleArgs e)
|
||||||
ValidationRules.AddRule(
|
//{
|
||||||
Csla.Validation.CommonRules.StringRequired, "UserID");
|
// if (_started > _ended)
|
||||||
ValidationRules.AddRule(
|
// {
|
||||||
Csla.Validation.CommonRules.StringMaxLength,
|
// e.Description = "Start date can't be after end date";
|
||||||
new Csla.Validation.CommonRules.MaxLengthRuleArgs("UserID", 100));
|
// return false;
|
||||||
// CSLATODO: Add other validation rules
|
// }
|
||||||
}
|
// else
|
||||||
// Sample data comparison validation rule
|
// return true;
|
||||||
//private bool StartDateGTEndDate(object target, Csla.Validation.RuleArgs e)
|
//}
|
||||||
//{
|
#endregion
|
||||||
// if (_started > _ended)
|
#region Authorization Rules
|
||||||
// {
|
protected override void AddAuthorizationRules()
|
||||||
// e.Description = "Start date can't be after end date";
|
{
|
||||||
// return false;
|
//CSLATODO: Who can read/write which fields
|
||||||
// }
|
//AuthorizationRules.AllowRead(ItemID, "<Role(s)>");
|
||||||
// else
|
//AuthorizationRules.AllowRead(PreviousID, "<Role(s)>");
|
||||||
// return true;
|
//AuthorizationRules.AllowWrite(PreviousID, "<Role(s)>");
|
||||||
//}
|
//AuthorizationRules.AllowRead(DTS, "<Role(s)>");
|
||||||
#endregion
|
//AuthorizationRules.AllowWrite(DTS, "<Role(s)>");
|
||||||
#region Authorization Rules
|
//AuthorizationRules.AllowRead(UserID, "<Role(s)>");
|
||||||
protected override void AddAuthorizationRules()
|
//AuthorizationRules.AllowWrite(UserID, "<Role(s)>");
|
||||||
{
|
}
|
||||||
//CSLATODO: Who can read/write which fields
|
public static bool CanAddObject()
|
||||||
//AuthorizationRules.AllowRead(ItemID, "<Role(s)>");
|
{
|
||||||
//AuthorizationRules.AllowRead(PreviousID, "<Role(s)>");
|
// CSLATODO: Can Add Authorization
|
||||||
//AuthorizationRules.AllowWrite(PreviousID, "<Role(s)>");
|
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
|
||||||
//AuthorizationRules.AllowRead(DTS, "<Role(s)>");
|
return true;
|
||||||
//AuthorizationRules.AllowWrite(DTS, "<Role(s)>");
|
}
|
||||||
//AuthorizationRules.AllowRead(UserID, "<Role(s)>");
|
public static bool CanGetObject()
|
||||||
//AuthorizationRules.AllowWrite(UserID, "<Role(s)>");
|
{
|
||||||
}
|
// CSLATODO: CanGet Authorization
|
||||||
public static bool CanAddObject()
|
return true;
|
||||||
{
|
}
|
||||||
// CSLATODO: Can Add Authorization
|
public static bool CanDeleteObject()
|
||||||
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
|
{
|
||||||
return true;
|
// CSLATODO: CanDelete Authorization
|
||||||
}
|
//bool result = false;
|
||||||
public static bool CanGetObject()
|
//if (Csla.ApplicationContext.User.IsInRole("ProjectManager"))result = true;
|
||||||
{
|
//if (Csla.ApplicationContext.User.IsInRole("Administrator"))result = true;
|
||||||
// CSLATODO: CanGet Authorization
|
//return result;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public static bool CanDeleteObject()
|
public static bool CanEditObject()
|
||||||
{
|
{
|
||||||
// CSLATODO: CanDelete Authorization
|
// CSLATODO: CanEdit Authorization
|
||||||
//bool result = false;
|
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
|
||||||
//if (Csla.ApplicationContext.User.IsInRole("ProjectManager"))result = true;
|
return true;
|
||||||
//if (Csla.ApplicationContext.User.IsInRole("Administrator"))result = true;
|
}
|
||||||
//return result;
|
#endregion
|
||||||
return true;
|
#region Factory Methods
|
||||||
}
|
public int CurrentEditLevel
|
||||||
public static bool CanEditObject()
|
{ get { return EditLevel; } }
|
||||||
{
|
private static int _ContentItemUnique = 0;
|
||||||
// CSLATODO: CanEdit Authorization
|
private static int ContentItemUnique
|
||||||
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
|
{ get { return ++_ContentItemUnique; } }
|
||||||
return true;
|
private int _MyContentItemUnique = ContentItemUnique;
|
||||||
}
|
public int MyContentItemUnique // Absolutely Unique ID - Editable FK
|
||||||
#endregion
|
{ get { return _MyContentItemUnique; } }
|
||||||
#region Factory Methods
|
internal static ContentItem New()
|
||||||
public int CurrentEditLevel
|
{
|
||||||
{ get { return EditLevel; } }
|
return new ContentItem();
|
||||||
private static int _ContentItemUnique = 0;
|
}
|
||||||
private static int ContentItemUnique
|
internal static ContentItem Get(SafeDataReader dr)
|
||||||
{ get { return ++_ContentItemUnique; } }
|
{
|
||||||
private int _MyContentItemUnique = ContentItemUnique;
|
return new ContentItem(dr);
|
||||||
public int MyContentItemUnique // Absolutely Unique ID - Editable FK
|
}
|
||||||
{ get { return _MyContentItemUnique; } }
|
public ContentItem()
|
||||||
internal static ContentItem New()
|
{
|
||||||
{
|
MarkAsChild();
|
||||||
return new ContentItem();
|
_ItemID = Item.NextItemID;
|
||||||
}
|
_DTS = _ContentItemExtension.DefaultDTS;
|
||||||
internal static ContentItem Get(SafeDataReader dr)
|
_UserID = _ContentItemExtension.DefaultUserID;
|
||||||
{
|
ValidationRules.CheckRules();
|
||||||
return new ContentItem(dr);
|
}
|
||||||
}
|
internal ContentItem(SafeDataReader dr)
|
||||||
public ContentItem()
|
{
|
||||||
{
|
MarkAsChild();
|
||||||
MarkAsChild();
|
Fetch(dr);
|
||||||
_ItemID = Item.NextItemID;
|
}
|
||||||
_DTS = _ContentItemExtension.DefaultDTS;
|
private bool _Disposed = false;
|
||||||
_UserID = _ContentItemExtension.DefaultUserID;
|
private static int _CountCreated = 0;
|
||||||
ValidationRules.CheckRules();
|
private static int _CountDisposed = 0;
|
||||||
}
|
private static int _CountFinalized = 0;
|
||||||
internal ContentItem(SafeDataReader dr)
|
private static int IncrementCountCreated
|
||||||
{
|
{ get { return ++_CountCreated; } }
|
||||||
MarkAsChild();
|
private int _CountWhenCreated = IncrementCountCreated;
|
||||||
Fetch(dr);
|
public static int CountCreated
|
||||||
}
|
{ get { return _CountCreated; } }
|
||||||
private bool _Disposed = false;
|
public static int CountNotDisposed
|
||||||
private static int _CountCreated = 0;
|
{ get { return _CountCreated - _CountDisposed; } }
|
||||||
private static int _CountDisposed = 0;
|
public static int CountNotFinalized
|
||||||
private static int _CountFinalized = 0;
|
{ get { return _CountCreated - _CountFinalized; } }
|
||||||
private static int IncrementCountCreated
|
~ContentItem()
|
||||||
{ get { return ++_CountCreated; } }
|
{
|
||||||
private int _CountWhenCreated = IncrementCountCreated;
|
_CountFinalized++;
|
||||||
public static int CountCreated
|
}
|
||||||
{ get { return _CountCreated; } }
|
public void Dispose()
|
||||||
public static int CountNotDisposed
|
{
|
||||||
{ get { return _CountCreated - _CountDisposed; } }
|
if (_Disposed) return;
|
||||||
public static int CountNotFinalized
|
_CountDisposed++;
|
||||||
{ get { return _CountCreated - _CountFinalized; } }
|
_Disposed = true;
|
||||||
~ContentItem()
|
}
|
||||||
{
|
#endregion
|
||||||
_CountFinalized++;
|
#region Data Access Portal
|
||||||
}
|
private void Fetch(SafeDataReader dr)
|
||||||
public void Dispose()
|
{
|
||||||
{
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentItem.FetchDR", GetHashCode());
|
||||||
if (_Disposed) return;
|
try
|
||||||
_CountDisposed++;
|
{
|
||||||
_Disposed = true;
|
_ItemID = dr.GetInt32("ItemID");
|
||||||
}
|
_PreviousID = (int?)dr.GetValue("PreviousID");
|
||||||
#endregion
|
_DTS = dr.GetDateTime("DTS");
|
||||||
#region Data Access Portal
|
_UserID = dr.GetString("UserID");
|
||||||
private void Fetch(SafeDataReader dr)
|
dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
|
||||||
{
|
}
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentItem.FetchDR", GetHashCode());
|
catch (Exception ex) // FKItem Fetch
|
||||||
try
|
{
|
||||||
{
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentItem.FetchDR", ex);
|
||||||
_ItemID = dr.GetInt32("ItemID");
|
throw new DbCslaException("ContentItem.Fetch", ex);
|
||||||
_PreviousID = (int?)dr.GetValue("PreviousID");
|
}
|
||||||
_DTS = dr.GetDateTime("DTS");
|
MarkOld();
|
||||||
_UserID = dr.GetString("UserID");
|
}
|
||||||
dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
|
internal void Insert(Content myContent)
|
||||||
}
|
{
|
||||||
catch (Exception ex) // FKItem Fetch
|
// if we're not dirty then don't update the database
|
||||||
{
|
if (!this.IsDirty) return;
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentItem.FetchDR", ex);
|
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||||
throw new DbCslaException("ContentItem.Fetch", ex);
|
_LastChanged = Item.Add(cn, ref _ItemID, Item.Get((int)_PreviousID), myContent, _DTS, _UserID);
|
||||||
}
|
MarkOld();
|
||||||
MarkOld();
|
}
|
||||||
}
|
internal void Update(Content myContent)
|
||||||
internal void Insert(Content myContent)
|
{
|
||||||
{
|
// if we're not dirty then don't update the database
|
||||||
// if we're not dirty then don't update the database
|
if (!this.IsDirty) return;
|
||||||
if (!this.IsDirty) return;
|
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
_LastChanged = Item.Update(cn, ref _ItemID, _PreviousID, myContent.ContentID, _DTS, _UserID, ref _LastChanged);
|
||||||
_LastChanged = Item.Add(cn, ref _ItemID, Item.Get((int)_PreviousID), myContent, _DTS, _UserID);
|
MarkOld();
|
||||||
MarkOld();
|
}
|
||||||
}
|
internal void DeleteSelf(Content myContent)
|
||||||
internal void Update(Content myContent)
|
{
|
||||||
{
|
// if we're not dirty then don't update the database
|
||||||
// if we're not dirty then don't update the database
|
if (!this.IsDirty) return;
|
||||||
if (!this.IsDirty) return;
|
// if we're new then don't update the database
|
||||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
if (this.IsNew) return;
|
||||||
_LastChanged = Item.Update(cn, ref _ItemID, _PreviousID, myContent.ContentID, _DTS, _UserID, ref _LastChanged);
|
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||||
MarkOld();
|
Item.Remove(cn, _ItemID);
|
||||||
}
|
MarkNew();
|
||||||
internal void DeleteSelf(Content myContent)
|
}
|
||||||
{
|
#endregion
|
||||||
// if we're not dirty then don't update the database
|
// Standard Default Code
|
||||||
if (!this.IsDirty) return;
|
#region extension
|
||||||
// if we're new then don't update the database
|
ContentItemExtension _ContentItemExtension = new ContentItemExtension();
|
||||||
if (this.IsNew) return;
|
[Serializable()]
|
||||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
partial class ContentItemExtension : extensionBase
|
||||||
Item.Remove(cn, _ItemID);
|
{
|
||||||
MarkNew();
|
}
|
||||||
}
|
[Serializable()]
|
||||||
#endregion
|
class extensionBase
|
||||||
// Standard Default Code
|
{
|
||||||
#region extension
|
// Default Values
|
||||||
ContentItemExtension _ContentItemExtension = new ContentItemExtension();
|
public virtual DateTime DefaultDTS
|
||||||
[Serializable()]
|
{
|
||||||
partial class ContentItemExtension : extensionBase
|
get { return DateTime.Now; }
|
||||||
{
|
}
|
||||||
}
|
public virtual string DefaultUserID
|
||||||
[Serializable()]
|
{
|
||||||
class extensionBase
|
get { return Volian.Base.Library.VlnSettings.UserID; }
|
||||||
{
|
}
|
||||||
// Default Values
|
// Authorization Rules
|
||||||
public virtual DateTime DefaultDTS
|
public virtual void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
|
||||||
{
|
{
|
||||||
get { return DateTime.Now; }
|
// Needs to be overriden to add new authorization rules
|
||||||
}
|
}
|
||||||
public virtual string DefaultUserID
|
// Instance Authorization Rules
|
||||||
{
|
public virtual void AddInstanceAuthorizationRules(Csla.Security.AuthorizationRules rules)
|
||||||
get { return Volian.Base.Library.VlnSettings.UserID; }
|
{
|
||||||
}
|
// Needs to be overriden to add new authorization rules
|
||||||
// Authorization Rules
|
}
|
||||||
public virtual void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
|
// Validation Rules
|
||||||
{
|
public virtual void AddValidationRules(Csla.Validation.ValidationRules rules)
|
||||||
// Needs to be overriden to add new authorization rules
|
{
|
||||||
}
|
// Needs to be overriden to add new validation rules
|
||||||
// Instance Authorization Rules
|
}
|
||||||
public virtual void AddInstanceAuthorizationRules(Csla.Security.AuthorizationRules rules)
|
// InstanceValidation Rules
|
||||||
{
|
public virtual void AddInstanceValidationRules(Csla.Validation.ValidationRules rules)
|
||||||
// Needs to be overriden to add new authorization rules
|
{
|
||||||
}
|
// Needs to be overriden to add new validation rules
|
||||||
// Validation Rules
|
}
|
||||||
public virtual void AddValidationRules(Csla.Validation.ValidationRules rules)
|
}
|
||||||
{
|
#endregion
|
||||||
// Needs to be overriden to add new validation rules
|
} // Class
|
||||||
}
|
#region Converter
|
||||||
// InstanceValidation Rules
|
internal class ContentItemConverter : ExpandableObjectConverter
|
||||||
public virtual void AddInstanceValidationRules(Csla.Validation.ValidationRules rules)
|
{
|
||||||
{
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
// Needs to be overriden to add new validation rules
|
{
|
||||||
}
|
if (destType == typeof(string) && value is ContentItem)
|
||||||
}
|
{
|
||||||
#endregion
|
// Return the ToString value
|
||||||
} // Class
|
return ((ContentItem)value).ToString();
|
||||||
#region Converter
|
}
|
||||||
internal class ContentItemConverter : ExpandableObjectConverter
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
{
|
}
|
||||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
}
|
||||||
{
|
#endregion
|
||||||
if (destType == typeof(string) && value is ContentItem)
|
|
||||||
{
|
|
||||||
// Return the ToString value
|
|
||||||
return ((ContentItem)value).ToString();
|
|
||||||
}
|
|
||||||
return base.ConvertTo(context, culture, value, destType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,470 +20,458 @@ using System.Collections.Generic;
|
|||||||
using Csla.Validation;
|
using Csla.Validation;
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ContentPart Generated by MyGeneration using the CSLA Object Mapping template
|
/// ContentPart Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
[TypeConverter(typeof(ContentPartConverter))]
|
[TypeConverter(typeof(ContentPartConverter))]
|
||||||
public partial class ContentPart : BusinessBase<ContentPart>, IVEHasBrokenRules, IDisposable
|
public partial class ContentPart : BusinessBase<ContentPart>, IVEHasBrokenRules, IDisposable
|
||||||
{
|
{
|
||||||
#region Log4Net
|
#region Log4Net
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#endregion
|
#endregion
|
||||||
#region Business Methods
|
#region Business Methods
|
||||||
private string _ErrorMessage = string.Empty;
|
private string _ErrorMessage = string.Empty;
|
||||||
public string ErrorMessage
|
public string ErrorMessage
|
||||||
{
|
{
|
||||||
get { return _ErrorMessage; }
|
get { return _ErrorMessage; }
|
||||||
}
|
}
|
||||||
private int _FromType;
|
private int _FromType;
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
public int FromType
|
public int FromType
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("FromType", true);
|
return _FromType;
|
||||||
return _FromType;
|
}
|
||||||
}
|
}
|
||||||
}
|
private int _ItemID;
|
||||||
private int _ItemID;
|
public int ItemID
|
||||||
public int ItemID
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
get
|
||||||
get
|
{
|
||||||
{
|
if (_MyItem != null) _ItemID = _MyItem.ItemID;
|
||||||
CanReadProperty("ItemID", true);
|
return _ItemID;
|
||||||
if (_MyItem != null) _ItemID = _MyItem.ItemID;
|
}
|
||||||
return _ItemID;
|
}
|
||||||
}
|
private Item _MyItem;
|
||||||
}
|
public Item MyItem
|
||||||
private Item _MyItem;
|
{
|
||||||
public Item MyItem
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
if (_MyItem == null && _ItemID != 0) _MyItem = Item.Get(_ItemID);
|
||||||
{
|
return _MyItem;
|
||||||
CanReadProperty("MyItem", true);
|
}
|
||||||
if (_MyItem == null && _ItemID != 0) _MyItem = Item.Get(_ItemID);
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
return _MyItem;
|
set
|
||||||
}
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
if (_MyItem != value)
|
||||||
set
|
{
|
||||||
{
|
_MyItem = value;
|
||||||
CanWriteProperty("MyItem", true);
|
_ItemID = value.ItemID;// Update underlying data field
|
||||||
if (_MyItem != value)
|
PropertyHasChanged();
|
||||||
{
|
}
|
||||||
_MyItem = value;
|
}
|
||||||
_ItemID = value.ItemID;// Update underlying data field
|
}
|
||||||
PropertyHasChanged();
|
private DateTime _DTS = new DateTime();
|
||||||
}
|
public DateTime DTS
|
||||||
}
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
private DateTime _DTS = new DateTime();
|
get
|
||||||
public DateTime DTS
|
{
|
||||||
{
|
return _DTS;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
set
|
||||||
CanReadProperty("DTS", true);
|
{
|
||||||
return _DTS;
|
if (_DTS != value)
|
||||||
}
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
_DTS = value;
|
||||||
set
|
PropertyHasChanged();
|
||||||
{
|
}
|
||||||
CanWriteProperty("DTS", true);
|
}
|
||||||
if (_DTS != value)
|
}
|
||||||
{
|
private string _UserID = string.Empty;
|
||||||
_DTS = value;
|
public string UserID
|
||||||
PropertyHasChanged();
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
}
|
{
|
||||||
private string _UserID = string.Empty;
|
return _UserID;
|
||||||
public string UserID
|
}
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
set
|
||||||
get
|
{
|
||||||
{
|
if (value == null) value = string.Empty;
|
||||||
CanReadProperty("UserID", true);
|
if (_UserID != value)
|
||||||
return _UserID;
|
{
|
||||||
}
|
_UserID = value;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
PropertyHasChanged();
|
||||||
set
|
}
|
||||||
{
|
}
|
||||||
CanWriteProperty("UserID", true);
|
}
|
||||||
if (value == null) value = string.Empty;
|
private byte[] _LastChanged = new byte[8];//timestamp
|
||||||
if (_UserID != value)
|
private int? _Item_PreviousID;
|
||||||
{
|
public int? Item_PreviousID
|
||||||
_UserID = value;
|
{
|
||||||
PropertyHasChanged();
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
}
|
{
|
||||||
}
|
return _Item_PreviousID;
|
||||||
private byte[] _LastChanged = new byte[8];//timestamp
|
}
|
||||||
private int? _Item_PreviousID;
|
}
|
||||||
public int? Item_PreviousID
|
private int _Item_ContentID;
|
||||||
{
|
public int Item_ContentID
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
CanReadProperty("Item_PreviousID", true);
|
{
|
||||||
return _Item_PreviousID;
|
return _Item_ContentID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private int _Item_ContentID;
|
private DateTime _Item_DTS = new DateTime();
|
||||||
public int Item_ContentID
|
public DateTime Item_DTS
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("Item_ContentID", true);
|
return _Item_DTS;
|
||||||
return _Item_ContentID;
|
}
|
||||||
}
|
}
|
||||||
}
|
private string _Item_UserID = string.Empty;
|
||||||
private DateTime _Item_DTS = new DateTime();
|
public string Item_UserID
|
||||||
public DateTime Item_DTS
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
get
|
||||||
get
|
{
|
||||||
{
|
return _Item_UserID;
|
||||||
CanReadProperty("Item_DTS", true);
|
}
|
||||||
return _Item_DTS;
|
}
|
||||||
}
|
// CSLATODO: Check ContentPart.GetIdValue to assure that the ID returned is unique
|
||||||
}
|
/// <summary>
|
||||||
private string _Item_UserID = string.Empty;
|
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||||
public string Item_UserID
|
/// </summary>
|
||||||
{
|
/// <returns>A Unique ID for the current ContentPart</returns>
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
protected override object GetIdValue()
|
||||||
get
|
{
|
||||||
{
|
return MyContentPartUnique; // Absolutely Unique ID
|
||||||
CanReadProperty("Item_UserID", true);
|
}
|
||||||
return _Item_UserID;
|
// CSLATODO: Replace base ContentPart.ToString function as necessary
|
||||||
}
|
/// <summary>
|
||||||
}
|
/// Overrides Base ToString
|
||||||
// CSLATODO: Check ContentPart.GetIdValue to assure that the ID returned is unique
|
/// </summary>
|
||||||
/// <summary>
|
/// <returns>A string representation of current ContentPart</returns>
|
||||||
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
//public override string ToString()
|
||||||
/// </summary>
|
//{
|
||||||
/// <returns>A Unique ID for the current ContentPart</returns>
|
// return base.ToString();
|
||||||
protected override object GetIdValue()
|
//}
|
||||||
{
|
public override bool IsDirty
|
||||||
return MyContentPartUnique; // Absolutely Unique ID
|
{
|
||||||
}
|
get
|
||||||
// CSLATODO: Replace base ContentPart.ToString function as necessary
|
{
|
||||||
/// <summary>
|
if (base.IsDirty)
|
||||||
/// Overrides Base ToString
|
return true;
|
||||||
/// </summary>
|
return IsDirtyList(new List<object>());
|
||||||
/// <returns>A string representation of current ContentPart</returns>
|
}
|
||||||
//public override string ToString()
|
}
|
||||||
//{
|
public bool IsDirtyList(List<object> list)
|
||||||
// return base.ToString();
|
{
|
||||||
//}
|
if (base.IsDirty || list.Contains(this))
|
||||||
public override bool IsDirty
|
return base.IsDirty;
|
||||||
{
|
list.Add(this);
|
||||||
get
|
return base.IsDirty || (_MyItem == null ? false : _MyItem.IsDirtyList(list));
|
||||||
{
|
}
|
||||||
if ( base.IsDirty )
|
public override bool IsValid
|
||||||
return true;
|
{
|
||||||
return IsDirtyList(new List<object>());
|
get { return IsValidList(new List<object>()); }
|
||||||
}
|
}
|
||||||
}
|
public bool IsValidList(List<object> list)
|
||||||
public bool IsDirtyList(List<object> list)
|
{
|
||||||
{
|
if (list.Contains(this))
|
||||||
if (base.IsDirty || list.Contains(this))
|
return (IsNew && !IsDirty) ? true : base.IsValid;
|
||||||
return base.IsDirty;
|
list.Add(this);
|
||||||
list.Add(this);
|
return ((IsNew && !IsDirty) ? true : base.IsValid) && (_MyItem == null ? true : _MyItem.IsValidList(list));
|
||||||
return base.IsDirty || (_MyItem == null ? false : _MyItem.IsDirtyList(list));
|
}
|
||||||
}
|
#endregion
|
||||||
public override bool IsValid
|
#region ValidationRules
|
||||||
{
|
[NonSerialized]
|
||||||
get { return IsValidList(new List<object>()); }
|
private bool _CheckingBrokenRules = false;
|
||||||
}
|
public IVEHasBrokenRules HasBrokenRules
|
||||||
public bool IsValidList(List<object> list)
|
{
|
||||||
{
|
get
|
||||||
if(list.Contains(this))
|
{
|
||||||
return (IsNew && !IsDirty) ? true : base.IsValid;
|
if (_CheckingBrokenRules) return null;
|
||||||
list.Add(this);
|
if (BrokenRulesCollection.Count > 0) return this;
|
||||||
return ((IsNew && !IsDirty) ? true : base.IsValid) && (_MyItem == null ? true : _MyItem.IsValidList(list));
|
try
|
||||||
}
|
{
|
||||||
#endregion
|
_CheckingBrokenRules = true;
|
||||||
#region ValidationRules
|
IVEHasBrokenRules hasBrokenRules = null;
|
||||||
[NonSerialized]
|
if (_MyItem != null && (hasBrokenRules = _MyItem.HasBrokenRules) != null) return hasBrokenRules;
|
||||||
private bool _CheckingBrokenRules = false;
|
return hasBrokenRules;
|
||||||
public IVEHasBrokenRules HasBrokenRules
|
}
|
||||||
{
|
finally
|
||||||
get
|
{
|
||||||
{
|
_CheckingBrokenRules = false;
|
||||||
if (_CheckingBrokenRules) return null;
|
}
|
||||||
if (BrokenRulesCollection.Count > 0) return this;
|
}
|
||||||
try
|
}
|
||||||
{
|
public BrokenRulesCollection BrokenRules
|
||||||
_CheckingBrokenRules = true;
|
{
|
||||||
IVEHasBrokenRules hasBrokenRules = null;
|
get
|
||||||
if (_MyItem != null && (hasBrokenRules = _MyItem.HasBrokenRules) != null) return hasBrokenRules;
|
{
|
||||||
return hasBrokenRules;
|
IVEHasBrokenRules hasBrokenRules = HasBrokenRules;
|
||||||
}
|
if (this.Equals(hasBrokenRules)) return BrokenRulesCollection;
|
||||||
finally
|
return (hasBrokenRules != null ? hasBrokenRules.BrokenRules : null);
|
||||||
{
|
}
|
||||||
_CheckingBrokenRules = false;
|
}
|
||||||
}
|
protected override void AddBusinessRules()
|
||||||
}
|
{
|
||||||
}
|
ValidationRules.AddRule<ContentPart>(MyItemRequired, "MyItem");
|
||||||
public BrokenRulesCollection BrokenRules
|
ValidationRules.AddRule(
|
||||||
{
|
Csla.Validation.CommonRules.StringRequired, "UserID");
|
||||||
get
|
ValidationRules.AddRule(
|
||||||
{
|
Csla.Validation.CommonRules.StringMaxLength,
|
||||||
IVEHasBrokenRules hasBrokenRules = HasBrokenRules;
|
new Csla.Validation.CommonRules.MaxLengthRuleArgs("UserID", 100));
|
||||||
if (this.Equals(hasBrokenRules)) return BrokenRulesCollection;
|
// CSLATODO: Add other validation rules
|
||||||
return (hasBrokenRules != null ? hasBrokenRules.BrokenRules : null);
|
}
|
||||||
}
|
private static bool MyItemRequired(ContentPart target, Csla.Validation.RuleArgs e)
|
||||||
}
|
{
|
||||||
protected override void AddBusinessRules()
|
if (target._ItemID == 0 && target._MyItem == null) // Required field missing
|
||||||
{
|
{
|
||||||
ValidationRules.AddRule<ContentPart>(MyItemRequired, "MyItem");
|
e.Description = "Required";
|
||||||
ValidationRules.AddRule(
|
return false;
|
||||||
Csla.Validation.CommonRules.StringRequired, "UserID");
|
}
|
||||||
ValidationRules.AddRule(
|
return true;
|
||||||
Csla.Validation.CommonRules.StringMaxLength,
|
}
|
||||||
new Csla.Validation.CommonRules.MaxLengthRuleArgs("UserID", 100));
|
// Sample data comparison validation rule
|
||||||
// CSLATODO: Add other validation rules
|
//private bool StartDateGTEndDate(object target, Csla.Validation.RuleArgs e)
|
||||||
}
|
//{
|
||||||
private static bool MyItemRequired(ContentPart target, Csla.Validation.RuleArgs e)
|
// if (_started > _ended)
|
||||||
{
|
// {
|
||||||
if (target._ItemID == 0 && target._MyItem == null) // Required field missing
|
// e.Description = "Start date can't be after end date";
|
||||||
{
|
// return false;
|
||||||
e.Description = "Required";
|
// }
|
||||||
return false;
|
// else
|
||||||
}
|
// return true;
|
||||||
return true;
|
//}
|
||||||
}
|
#endregion
|
||||||
// Sample data comparison validation rule
|
#region Authorization Rules
|
||||||
//private bool StartDateGTEndDate(object target, Csla.Validation.RuleArgs e)
|
protected override void AddAuthorizationRules()
|
||||||
//{
|
{
|
||||||
// if (_started > _ended)
|
//CSLATODO: Who can read/write which fields
|
||||||
// {
|
//AuthorizationRules.AllowRead(FromType, "<Role(s)>");
|
||||||
// e.Description = "Start date can't be after end date";
|
//AuthorizationRules.AllowRead(ItemID, "<Role(s)>");
|
||||||
// return false;
|
//AuthorizationRules.AllowWrite(ItemID, "<Role(s)>");
|
||||||
// }
|
//AuthorizationRules.AllowRead(DTS, "<Role(s)>");
|
||||||
// else
|
//AuthorizationRules.AllowWrite(DTS, "<Role(s)>");
|
||||||
// return true;
|
//AuthorizationRules.AllowRead(UserID, "<Role(s)>");
|
||||||
//}
|
//AuthorizationRules.AllowWrite(UserID, "<Role(s)>");
|
||||||
#endregion
|
}
|
||||||
#region Authorization Rules
|
public static bool CanAddObject()
|
||||||
protected override void AddAuthorizationRules()
|
{
|
||||||
{
|
// CSLATODO: Can Add Authorization
|
||||||
//CSLATODO: Who can read/write which fields
|
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
|
||||||
//AuthorizationRules.AllowRead(FromType, "<Role(s)>");
|
return true;
|
||||||
//AuthorizationRules.AllowRead(ItemID, "<Role(s)>");
|
}
|
||||||
//AuthorizationRules.AllowWrite(ItemID, "<Role(s)>");
|
public static bool CanGetObject()
|
||||||
//AuthorizationRules.AllowRead(DTS, "<Role(s)>");
|
{
|
||||||
//AuthorizationRules.AllowWrite(DTS, "<Role(s)>");
|
// CSLATODO: CanGet Authorization
|
||||||
//AuthorizationRules.AllowRead(UserID, "<Role(s)>");
|
return true;
|
||||||
//AuthorizationRules.AllowWrite(UserID, "<Role(s)>");
|
}
|
||||||
}
|
public static bool CanDeleteObject()
|
||||||
public static bool CanAddObject()
|
{
|
||||||
{
|
// CSLATODO: CanDelete Authorization
|
||||||
// CSLATODO: Can Add Authorization
|
//bool result = false;
|
||||||
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
|
//if (Csla.ApplicationContext.User.IsInRole("ProjectManager"))result = true;
|
||||||
return true;
|
//if (Csla.ApplicationContext.User.IsInRole("Administrator"))result = true;
|
||||||
}
|
//return result;
|
||||||
public static bool CanGetObject()
|
return true;
|
||||||
{
|
}
|
||||||
// CSLATODO: CanGet Authorization
|
public static bool CanEditObject()
|
||||||
return true;
|
{
|
||||||
}
|
// CSLATODO: CanEdit Authorization
|
||||||
public static bool CanDeleteObject()
|
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
|
||||||
{
|
return true;
|
||||||
// CSLATODO: CanDelete Authorization
|
}
|
||||||
//bool result = false;
|
#endregion
|
||||||
//if (Csla.ApplicationContext.User.IsInRole("ProjectManager"))result = true;
|
#region Factory Methods
|
||||||
//if (Csla.ApplicationContext.User.IsInRole("Administrator"))result = true;
|
public int CurrentEditLevel
|
||||||
//return result;
|
{ get { return EditLevel; } }
|
||||||
return true;
|
private static int _ContentPartUnique = 0;
|
||||||
}
|
private static int ContentPartUnique
|
||||||
public static bool CanEditObject()
|
{ get { return ++_ContentPartUnique; } }
|
||||||
{
|
private int _MyContentPartUnique = ContentPartUnique;
|
||||||
// CSLATODO: CanEdit Authorization
|
public int MyContentPartUnique // Absolutely Unique ID - Editable FK
|
||||||
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
|
{ get { return _MyContentPartUnique; } }
|
||||||
return true;
|
internal static ContentPart New(int fromType, Item myItem)
|
||||||
}
|
{
|
||||||
#endregion
|
return new ContentPart(fromType, myItem);
|
||||||
#region Factory Methods
|
}
|
||||||
public int CurrentEditLevel
|
internal static ContentPart Get(SafeDataReader dr)
|
||||||
{ get { return EditLevel; } }
|
{
|
||||||
private static int _ContentPartUnique = 0;
|
return new ContentPart(dr);
|
||||||
private static int ContentPartUnique
|
}
|
||||||
{ get { return ++_ContentPartUnique; } }
|
public ContentPart()
|
||||||
private int _MyContentPartUnique = ContentPartUnique;
|
{
|
||||||
public int MyContentPartUnique // Absolutely Unique ID - Editable FK
|
MarkAsChild();
|
||||||
{ get { return _MyContentPartUnique; } }
|
|
||||||
internal static ContentPart New(int fromType, Item myItem)
|
|
||||||
{
|
|
||||||
return new ContentPart(fromType, myItem);
|
|
||||||
}
|
|
||||||
internal static ContentPart Get(SafeDataReader dr)
|
|
||||||
{
|
|
||||||
return new ContentPart(dr);
|
|
||||||
}
|
|
||||||
public ContentPart()
|
|
||||||
{
|
|
||||||
MarkAsChild();
|
|
||||||
|
|
||||||
_DTS = _ContentPartExtension.DefaultDTS;
|
_DTS = _ContentPartExtension.DefaultDTS;
|
||||||
_UserID = _ContentPartExtension.DefaultUserID;
|
_UserID = _ContentPartExtension.DefaultUserID;
|
||||||
ValidationRules.CheckRules();
|
ValidationRules.CheckRules();
|
||||||
}
|
}
|
||||||
private ContentPart(int fromType, Item myItem)
|
private ContentPart(int fromType, Item myItem)
|
||||||
{
|
{
|
||||||
MarkAsChild();
|
MarkAsChild();
|
||||||
// CSLATODO: Add any initialization & defaults
|
// CSLATODO: Add any initialization & defaults
|
||||||
_DTS = _ContentPartExtension.DefaultDTS;
|
_DTS = _ContentPartExtension.DefaultDTS;
|
||||||
_UserID = _ContentPartExtension.DefaultUserID;
|
_UserID = _ContentPartExtension.DefaultUserID;
|
||||||
_FromType = fromType;
|
_FromType = fromType;
|
||||||
_MyItem = myItem;
|
_MyItem = myItem;
|
||||||
ValidationRules.CheckRules();
|
ValidationRules.CheckRules();
|
||||||
}
|
}
|
||||||
internal ContentPart(SafeDataReader dr)
|
internal ContentPart(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
MarkAsChild();
|
MarkAsChild();
|
||||||
Fetch(dr);
|
Fetch(dr);
|
||||||
}
|
}
|
||||||
private bool _Disposed = false;
|
private bool _Disposed = false;
|
||||||
private static int _CountCreated = 0;
|
private static int _CountCreated = 0;
|
||||||
private static int _CountDisposed = 0;
|
private static int _CountDisposed = 0;
|
||||||
private static int _CountFinalized = 0;
|
private static int _CountFinalized = 0;
|
||||||
private static int IncrementCountCreated
|
private static int IncrementCountCreated
|
||||||
{ get { return ++_CountCreated; } }
|
{ get { return ++_CountCreated; } }
|
||||||
private int _CountWhenCreated = IncrementCountCreated;
|
private int _CountWhenCreated = IncrementCountCreated;
|
||||||
public static int CountCreated
|
public static int CountCreated
|
||||||
{ get { return _CountCreated; } }
|
{ get { return _CountCreated; } }
|
||||||
public static int CountNotDisposed
|
public static int CountNotDisposed
|
||||||
{ get { return _CountCreated - _CountDisposed; } }
|
{ get { return _CountCreated - _CountDisposed; } }
|
||||||
public static int CountNotFinalized
|
public static int CountNotFinalized
|
||||||
{ get { return _CountCreated - _CountFinalized; } }
|
{ get { return _CountCreated - _CountFinalized; } }
|
||||||
~ContentPart()
|
~ContentPart()
|
||||||
{
|
{
|
||||||
_CountFinalized++;
|
_CountFinalized++;
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
if (_Disposed) return;
|
if (_Disposed) return;
|
||||||
_CountDisposed++;
|
_CountDisposed++;
|
||||||
_Disposed = true;
|
_Disposed = true;
|
||||||
if (_MyItem != null)
|
if (_MyItem != null)
|
||||||
{
|
{
|
||||||
_MyItem.Dispose();
|
_MyItem.Dispose();
|
||||||
_MyItem = null;
|
_MyItem = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Data Access Portal
|
#region Data Access Portal
|
||||||
private void Fetch(SafeDataReader dr)
|
private void Fetch(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentPart.FetchDR", GetHashCode());
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentPart.FetchDR", GetHashCode());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_FromType = dr.GetInt32("FromType");
|
_FromType = dr.GetInt32("FromType");
|
||||||
_ItemID = dr.GetInt32("ItemID");
|
_ItemID = dr.GetInt32("ItemID");
|
||||||
_DTS = dr.GetDateTime("DTS");
|
_DTS = dr.GetDateTime("DTS");
|
||||||
_UserID = dr.GetString("UserID");
|
_UserID = dr.GetString("UserID");
|
||||||
dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
|
dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
|
||||||
_Item_PreviousID = (int?)dr.GetValue("Item_PreviousID");
|
_Item_PreviousID = (int?)dr.GetValue("Item_PreviousID");
|
||||||
_Item_ContentID = dr.GetInt32("Item_ContentID");
|
_Item_ContentID = dr.GetInt32("Item_ContentID");
|
||||||
_Item_DTS = dr.GetDateTime("Item_DTS");
|
_Item_DTS = dr.GetDateTime("Item_DTS");
|
||||||
_Item_UserID = dr.GetString("Item_UserID");
|
_Item_UserID = dr.GetString("Item_UserID");
|
||||||
}
|
}
|
||||||
catch (Exception ex) // FKItem Fetch
|
catch (Exception ex) // FKItem Fetch
|
||||||
{
|
{
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentPart.FetchDR", ex);
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentPart.FetchDR", ex);
|
||||||
throw new DbCslaException("ContentPart.Fetch", ex);
|
throw new DbCslaException("ContentPart.Fetch", ex);
|
||||||
}
|
}
|
||||||
MarkOld();
|
MarkOld();
|
||||||
}
|
}
|
||||||
internal void Insert(Content myContent)
|
internal void Insert(Content myContent)
|
||||||
{
|
{
|
||||||
// if we're not dirty then don't update the database
|
// if we're not dirty then don't update the database
|
||||||
if (!this.IsDirty) return;
|
if (!this.IsDirty) return;
|
||||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||||
_LastChanged = Part.Add(cn, myContent, _FromType, _MyItem, _DTS, _UserID);
|
_LastChanged = Part.Add(cn, myContent, _FromType, _MyItem, _DTS, _UserID);
|
||||||
MarkOld();
|
MarkOld();
|
||||||
}
|
}
|
||||||
internal void Update(Content myContent)
|
internal void Update(Content myContent)
|
||||||
{
|
{
|
||||||
// if we're not dirty then don't update the database
|
// if we're not dirty then don't update the database
|
||||||
if (!this.IsDirty) return;
|
if (!this.IsDirty) return;
|
||||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||||
_LastChanged = Part.Update(cn, myContent.ContentID, _FromType, _ItemID, _DTS, _UserID, ref _LastChanged);
|
_LastChanged = Part.Update(cn, myContent.ContentID, _FromType, _ItemID, _DTS, _UserID, ref _LastChanged);
|
||||||
MarkOld();
|
MarkOld();
|
||||||
}
|
}
|
||||||
internal void DeleteSelf(Content myContent)
|
internal void DeleteSelf(Content myContent)
|
||||||
{
|
{
|
||||||
// if we're not dirty then don't update the database
|
// if we're not dirty then don't update the database
|
||||||
if (!this.IsDirty) return;
|
if (!this.IsDirty) return;
|
||||||
// if we're new then don't update the database
|
// if we're new then don't update the database
|
||||||
if (this.IsNew) return;
|
if (this.IsNew) return;
|
||||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||||
Part.Remove(cn, myContent.ContentID, _FromType);
|
Part.Remove(cn, myContent.ContentID, _FromType);
|
||||||
MarkNew();
|
MarkNew();
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
// Standard Default Code
|
// Standard Default Code
|
||||||
#region extension
|
#region extension
|
||||||
ContentPartExtension _ContentPartExtension = new ContentPartExtension();
|
ContentPartExtension _ContentPartExtension = new ContentPartExtension();
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
partial class ContentPartExtension : extensionBase
|
partial class ContentPartExtension : extensionBase
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
class extensionBase
|
class extensionBase
|
||||||
{
|
{
|
||||||
// Default Values
|
// Default Values
|
||||||
public virtual DateTime DefaultDTS
|
public virtual DateTime DefaultDTS
|
||||||
{
|
{
|
||||||
get { return DateTime.Now; }
|
get { return DateTime.Now; }
|
||||||
}
|
}
|
||||||
public virtual string DefaultUserID
|
public virtual string DefaultUserID
|
||||||
{
|
{
|
||||||
get { return Volian.Base.Library.VlnSettings.UserID; }
|
get { return Volian.Base.Library.VlnSettings.UserID; }
|
||||||
}
|
}
|
||||||
// Authorization Rules
|
// Authorization Rules
|
||||||
public virtual void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
|
public virtual void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
|
||||||
{
|
{
|
||||||
// Needs to be overriden to add new authorization rules
|
// Needs to be overriden to add new authorization rules
|
||||||
}
|
}
|
||||||
// Instance Authorization Rules
|
// Instance Authorization Rules
|
||||||
public virtual void AddInstanceAuthorizationRules(Csla.Security.AuthorizationRules rules)
|
public virtual void AddInstanceAuthorizationRules(Csla.Security.AuthorizationRules rules)
|
||||||
{
|
{
|
||||||
// Needs to be overriden to add new authorization rules
|
// Needs to be overriden to add new authorization rules
|
||||||
}
|
}
|
||||||
// Validation Rules
|
// Validation Rules
|
||||||
public virtual void AddValidationRules(Csla.Validation.ValidationRules rules)
|
public virtual void AddValidationRules(Csla.Validation.ValidationRules rules)
|
||||||
{
|
{
|
||||||
// Needs to be overriden to add new validation rules
|
// Needs to be overriden to add new validation rules
|
||||||
}
|
}
|
||||||
// InstanceValidation Rules
|
// InstanceValidation Rules
|
||||||
public virtual void AddInstanceValidationRules(Csla.Validation.ValidationRules rules)
|
public virtual void AddInstanceValidationRules(Csla.Validation.ValidationRules rules)
|
||||||
{
|
{
|
||||||
// Needs to be overriden to add new validation rules
|
// Needs to be overriden to add new validation rules
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
} // Class
|
} // Class
|
||||||
#region Converter
|
#region Converter
|
||||||
internal class ContentPartConverter : ExpandableObjectConverter
|
internal class ContentPartConverter : ExpandableObjectConverter
|
||||||
{
|
{
|
||||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
{
|
{
|
||||||
if (destType == typeof(string) && value is ContentPart)
|
if (destType == typeof(string) && value is ContentPart)
|
||||||
{
|
{
|
||||||
// Return the ToString value
|
// Return the ToString value
|
||||||
return ((ContentPart)value).ToString();
|
return ((ContentPart)value).ToString();
|
||||||
}
|
}
|
||||||
return base.ConvertTo(context, culture, value, destType);
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -19,376 +19,366 @@ using System.ComponentModel;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
public delegate void AnnotationAuditInfoEvent(object sender);
|
public delegate void AnnotationAuditInfoEvent(object sender);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// AnnotationAuditInfo Generated by MyGeneration using the CSLA Object Mapping template
|
/// AnnotationAuditInfo Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
[TypeConverter(typeof(AnnotationAuditInfoConverter))]
|
[TypeConverter(typeof(AnnotationAuditInfoConverter))]
|
||||||
public partial class AnnotationAuditInfo : ReadOnlyBase<AnnotationAuditInfo>, IDisposable
|
public partial class AnnotationAuditInfo : ReadOnlyBase<AnnotationAuditInfo>, IDisposable
|
||||||
{
|
{
|
||||||
public event AnnotationAuditInfoEvent Changed;
|
public event AnnotationAuditInfoEvent Changed;
|
||||||
private void OnChange()
|
private void OnChange()
|
||||||
{
|
{
|
||||||
if (Changed != null) Changed(this);
|
if (Changed != null) Changed(this);
|
||||||
}
|
}
|
||||||
#region Log4Net
|
#region Log4Net
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
private static List<AnnotationAuditInfo> _CacheList = new List<AnnotationAuditInfo>();
|
private static List<AnnotationAuditInfo> _CacheList = new List<AnnotationAuditInfo>();
|
||||||
protected static void AddToCache(AnnotationAuditInfo annotationAuditInfo)
|
protected static void AddToCache(AnnotationAuditInfo annotationAuditInfo)
|
||||||
{
|
{
|
||||||
if (!_CacheList.Contains(annotationAuditInfo)) _CacheList.Add(annotationAuditInfo); // In AddToCache
|
if (!_CacheList.Contains(annotationAuditInfo)) _CacheList.Add(annotationAuditInfo); // In AddToCache
|
||||||
}
|
}
|
||||||
protected static void RemoveFromCache(AnnotationAuditInfo annotationAuditInfo)
|
protected static void RemoveFromCache(AnnotationAuditInfo annotationAuditInfo)
|
||||||
{
|
{
|
||||||
while (_CacheList.Contains(annotationAuditInfo)) _CacheList.Remove(annotationAuditInfo); // In RemoveFromCache
|
while (_CacheList.Contains(annotationAuditInfo)) _CacheList.Remove(annotationAuditInfo); // In RemoveFromCache
|
||||||
}
|
}
|
||||||
private static Dictionary<string, List<AnnotationAuditInfo>> _CacheByPrimaryKey = new Dictionary<string, List<AnnotationAuditInfo>>();
|
private static Dictionary<string, List<AnnotationAuditInfo>> _CacheByPrimaryKey = new Dictionary<string, List<AnnotationAuditInfo>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
while (_CacheList.Count > 0) // Move AnnotationAuditInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
while (_CacheList.Count > 0) // Move AnnotationAuditInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
||||||
{
|
{
|
||||||
AnnotationAuditInfo tmp = _CacheList[0]; // Get the first AnnotationAuditInfo
|
AnnotationAuditInfo tmp = _CacheList[0]; // Get the first AnnotationAuditInfo
|
||||||
string pKey = tmp.AuditID.ToString();
|
string pKey = tmp.AuditID.ToString();
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
||||||
{
|
{
|
||||||
_CacheByPrimaryKey[pKey] = new List<AnnotationAuditInfo>(); // Add new list for PrimaryKey
|
_CacheByPrimaryKey[pKey] = new List<AnnotationAuditInfo>(); // Add new list for PrimaryKey
|
||||||
}
|
}
|
||||||
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
||||||
_CacheList.RemoveAt(0); // Remove the first AnnotationAuditInfo
|
_CacheList.RemoveAt(0); // Remove the first AnnotationAuditInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
internal static void AddList(AnnotationAuditInfoList lst)
|
internal static void AddList(AnnotationAuditInfoList lst)
|
||||||
{
|
{
|
||||||
foreach (AnnotationAuditInfo item in lst) AddToCache(item);
|
foreach (AnnotationAuditInfo item in lst) AddToCache(item);
|
||||||
}
|
}
|
||||||
protected static AnnotationAuditInfo GetCachedByPrimaryKey(long auditID)
|
protected static AnnotationAuditInfo GetCachedByPrimaryKey(long auditID)
|
||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = auditID.ToString();
|
string key = auditID.ToString();
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Business Methods
|
#region Business Methods
|
||||||
private string _ErrorMessage = string.Empty;
|
private string _ErrorMessage = string.Empty;
|
||||||
public string ErrorMessage
|
public string ErrorMessage
|
||||||
{
|
{
|
||||||
get { return _ErrorMessage; }
|
get { return _ErrorMessage; }
|
||||||
}
|
}
|
||||||
protected AnnotationAudit _Editable;
|
protected AnnotationAudit _Editable;
|
||||||
private IVEHasBrokenRules HasBrokenRules
|
private IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
IVEHasBrokenRules hasBrokenRules = null;
|
IVEHasBrokenRules hasBrokenRules = null;
|
||||||
if (_Editable != null)
|
if (_Editable != null)
|
||||||
hasBrokenRules = _Editable.HasBrokenRules;
|
hasBrokenRules = _Editable.HasBrokenRules;
|
||||||
return hasBrokenRules;
|
return hasBrokenRules;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private long _AuditID;
|
private long _AuditID;
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
public long AuditID
|
public long AuditID
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("AuditID", true);
|
return _AuditID;
|
||||||
return _AuditID;
|
}
|
||||||
}
|
}
|
||||||
}
|
private int _AnnotationID;
|
||||||
private int _AnnotationID;
|
public int AnnotationID
|
||||||
public int AnnotationID
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
get
|
||||||
get
|
{
|
||||||
{
|
return _AnnotationID;
|
||||||
CanReadProperty("AnnotationID", true);
|
}
|
||||||
return _AnnotationID;
|
}
|
||||||
}
|
private int _ItemID;
|
||||||
}
|
public int ItemID
|
||||||
private int _ItemID;
|
{
|
||||||
public int ItemID
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
return _ItemID;
|
||||||
{
|
}
|
||||||
CanReadProperty("ItemID", true);
|
}
|
||||||
return _ItemID;
|
private int _TypeID;
|
||||||
}
|
public int TypeID
|
||||||
}
|
{
|
||||||
private int _TypeID;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
public int TypeID
|
get
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
return _TypeID;
|
||||||
get
|
}
|
||||||
{
|
}
|
||||||
CanReadProperty("TypeID", true);
|
private string _RtfText = string.Empty;
|
||||||
return _TypeID;
|
public string RtfText
|
||||||
}
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
private string _RtfText = string.Empty;
|
get
|
||||||
public string RtfText
|
{
|
||||||
{
|
return _RtfText;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
}
|
||||||
{
|
private string _SearchText = string.Empty;
|
||||||
CanReadProperty("RtfText", true);
|
public string SearchText
|
||||||
return _RtfText;
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
private string _SearchText = string.Empty;
|
{
|
||||||
public string SearchText
|
return _SearchText;
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
private string _Config = string.Empty;
|
||||||
{
|
public string Config
|
||||||
CanReadProperty("SearchText", true);
|
{
|
||||||
return _SearchText;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
}
|
{
|
||||||
private string _Config = string.Empty;
|
return _Config;
|
||||||
public string Config
|
}
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
private DateTime _DTS = new DateTime();
|
||||||
get
|
public DateTime DTS
|
||||||
{
|
{
|
||||||
CanReadProperty("Config", true);
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
return _Config;
|
get
|
||||||
}
|
{
|
||||||
}
|
return _DTS;
|
||||||
private DateTime _DTS = new DateTime();
|
}
|
||||||
public DateTime DTS
|
}
|
||||||
{
|
private string _UserID = string.Empty;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
public string UserID
|
||||||
get
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
CanReadProperty("DTS", true);
|
get
|
||||||
return _DTS;
|
{
|
||||||
}
|
return _UserID;
|
||||||
}
|
}
|
||||||
private string _UserID = string.Empty;
|
}
|
||||||
public string UserID
|
private int _DeleteStatus;
|
||||||
{
|
public int DeleteStatus
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
CanReadProperty("UserID", true);
|
{
|
||||||
return _UserID;
|
return _DeleteStatus;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private int _DeleteStatus;
|
// CSLATODO: Replace base AnnotationAuditInfo.ToString function as necessary
|
||||||
public int DeleteStatus
|
/// <summary>
|
||||||
{
|
/// Overrides Base ToString
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
/// </summary>
|
||||||
get
|
/// <returns>A string representation of current AnnotationAuditInfo</returns>
|
||||||
{
|
//public override string ToString()
|
||||||
CanReadProperty("DeleteStatus", true);
|
//{
|
||||||
return _DeleteStatus;
|
// return base.ToString();
|
||||||
}
|
//}
|
||||||
}
|
// CSLATODO: Check AnnotationAuditInfo.GetIdValue to assure that the ID returned is unique
|
||||||
// CSLATODO: Replace base AnnotationAuditInfo.ToString function as necessary
|
/// <summary>
|
||||||
/// <summary>
|
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||||
/// Overrides Base ToString
|
/// </summary>
|
||||||
/// </summary>
|
/// <returns>A Unique ID for the current AnnotationAuditInfo</returns>
|
||||||
/// <returns>A string representation of current AnnotationAuditInfo</returns>
|
protected override object GetIdValue()
|
||||||
//public override string ToString()
|
{
|
||||||
//{
|
return MyAnnotationAuditInfoUnique; // Absolutely Unique ID
|
||||||
// return base.ToString();
|
}
|
||||||
//}
|
#endregion
|
||||||
// CSLATODO: Check AnnotationAuditInfo.GetIdValue to assure that the ID returned is unique
|
#region Factory Methods
|
||||||
/// <summary>
|
private static int _AnnotationAuditInfoUnique = 0;
|
||||||
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
private static int AnnotationAuditInfoUnique
|
||||||
/// </summary>
|
{ get { return ++_AnnotationAuditInfoUnique; } }
|
||||||
/// <returns>A Unique ID for the current AnnotationAuditInfo</returns>
|
private int _MyAnnotationAuditInfoUnique = AnnotationAuditInfoUnique;
|
||||||
protected override object GetIdValue()
|
public int MyAnnotationAuditInfoUnique // Absolutely Unique ID - Info
|
||||||
{
|
{ get { return _MyAnnotationAuditInfoUnique; } }
|
||||||
return MyAnnotationAuditInfoUnique; // Absolutely Unique ID
|
protected AnnotationAuditInfo()
|
||||||
}
|
{/* require use of factory methods */
|
||||||
#endregion
|
AddToCache(this);
|
||||||
#region Factory Methods
|
}
|
||||||
private static int _AnnotationAuditInfoUnique = 0;
|
public void Dispose()
|
||||||
private static int AnnotationAuditInfoUnique
|
{
|
||||||
{ get { return ++_AnnotationAuditInfoUnique; } }
|
RemoveFromCache(this);
|
||||||
private int _MyAnnotationAuditInfoUnique = AnnotationAuditInfoUnique;
|
if (!_CacheByPrimaryKey.ContainsKey(AuditID.ToString())) return;
|
||||||
public int MyAnnotationAuditInfoUnique // Absolutely Unique ID - Info
|
List<AnnotationAuditInfo> listAnnotationAuditInfo = _CacheByPrimaryKey[AuditID.ToString()]; // Get the list of items
|
||||||
{ get { return _MyAnnotationAuditInfoUnique; } }
|
while (listAnnotationAuditInfo.Contains(this)) listAnnotationAuditInfo.Remove(this); // Remove the item from the list
|
||||||
protected AnnotationAuditInfo()
|
if (listAnnotationAuditInfo.Count == 0) // If there are no items left in the list
|
||||||
{/* require use of factory methods */
|
_CacheByPrimaryKey.Remove(AuditID.ToString()); // remove the list
|
||||||
AddToCache(this);
|
}
|
||||||
}
|
public virtual AnnotationAudit Get()
|
||||||
public void Dispose()
|
{
|
||||||
{
|
return _Editable = AnnotationAudit.Get(_AuditID);
|
||||||
RemoveFromCache(this);
|
}
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(AuditID.ToString())) return;
|
public static void Refresh(AnnotationAudit tmp)
|
||||||
List<AnnotationAuditInfo> listAnnotationAuditInfo = _CacheByPrimaryKey[AuditID.ToString()]; // Get the list of items
|
{
|
||||||
while (listAnnotationAuditInfo.Contains(this)) listAnnotationAuditInfo.Remove(this); // Remove the item from the list
|
string key = tmp.AuditID.ToString();
|
||||||
if (listAnnotationAuditInfo.Count == 0) // If there are no items left in the list
|
ConvertListToDictionary();
|
||||||
_CacheByPrimaryKey.Remove(AuditID.ToString()); // remove the list
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
}
|
foreach (AnnotationAuditInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
public virtual AnnotationAudit Get()
|
tmpInfo.RefreshFields(tmp);
|
||||||
{
|
}
|
||||||
return _Editable = AnnotationAudit.Get(_AuditID);
|
protected virtual void RefreshFields(AnnotationAudit tmp)
|
||||||
}
|
{
|
||||||
public static void Refresh(AnnotationAudit tmp)
|
_AnnotationID = tmp.AnnotationID;
|
||||||
{
|
_ItemID = tmp.ItemID;
|
||||||
string key = tmp.AuditID.ToString();
|
_TypeID = tmp.TypeID;
|
||||||
ConvertListToDictionary();
|
_RtfText = tmp.RtfText;
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
_SearchText = tmp.SearchText;
|
||||||
foreach (AnnotationAuditInfo tmpInfo in _CacheByPrimaryKey[key])
|
_Config = tmp.Config;
|
||||||
tmpInfo.RefreshFields(tmp);
|
_DTS = tmp.DTS;
|
||||||
}
|
_UserID = tmp.UserID;
|
||||||
protected virtual void RefreshFields(AnnotationAudit tmp)
|
_DeleteStatus = tmp.DeleteStatus;
|
||||||
{
|
_AnnotationAuditInfoExtension.Refresh(this);
|
||||||
_AnnotationID = tmp.AnnotationID;
|
OnChange();// raise an event
|
||||||
_ItemID = tmp.ItemID;
|
}
|
||||||
_TypeID = tmp.TypeID;
|
public static AnnotationAuditInfo Get(long auditID)
|
||||||
_RtfText = tmp.RtfText;
|
{
|
||||||
_SearchText = tmp.SearchText;
|
//if (!CanGetObject())
|
||||||
_Config = tmp.Config;
|
// throw new System.Security.SecurityException("User not authorized to view a AnnotationAudit");
|
||||||
_DTS = tmp.DTS;
|
try
|
||||||
_UserID = tmp.UserID;
|
{
|
||||||
_DeleteStatus = tmp.DeleteStatus;
|
AnnotationAuditInfo tmp = GetCachedByPrimaryKey(auditID);
|
||||||
_AnnotationAuditInfoExtension.Refresh(this);
|
if (tmp == null)
|
||||||
OnChange();// raise an event
|
{
|
||||||
}
|
tmp = DataPortal.Fetch<AnnotationAuditInfo>(new PKCriteria(auditID));
|
||||||
public static AnnotationAuditInfo Get(long auditID)
|
AddToCache(tmp);
|
||||||
{
|
}
|
||||||
//if (!CanGetObject())
|
if (tmp.ErrorMessage == "No Record Found")
|
||||||
// throw new System.Security.SecurityException("User not authorized to view a AnnotationAudit");
|
{
|
||||||
try
|
tmp.Dispose(); // Clean-up AnnotationAuditInfo
|
||||||
{
|
tmp = null;
|
||||||
AnnotationAuditInfo tmp = GetCachedByPrimaryKey(auditID);
|
}
|
||||||
if (tmp == null)
|
return tmp;
|
||||||
{
|
}
|
||||||
tmp = DataPortal.Fetch<AnnotationAuditInfo>(new PKCriteria(auditID));
|
catch (Exception ex)
|
||||||
AddToCache(tmp);
|
{
|
||||||
}
|
throw new DbCslaException("Error on AnnotationAuditInfo.Get", ex);
|
||||||
if (tmp.ErrorMessage == "No Record Found")
|
}
|
||||||
{
|
}
|
||||||
tmp.Dispose(); // Clean-up AnnotationAuditInfo
|
#endregion
|
||||||
tmp = null;
|
#region Data Access Portal
|
||||||
}
|
internal AnnotationAuditInfo(SafeDataReader dr)
|
||||||
return tmp;
|
{
|
||||||
}
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationAuditInfo.Constructor", GetHashCode());
|
||||||
catch (Exception ex)
|
try
|
||||||
{
|
{
|
||||||
throw new DbCslaException("Error on AnnotationAuditInfo.Get", ex);
|
ReadData(dr);
|
||||||
}
|
}
|
||||||
}
|
catch (Exception ex)
|
||||||
#endregion
|
{
|
||||||
#region Data Access Portal
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationAuditInfo.Constructor", ex);
|
||||||
internal AnnotationAuditInfo(SafeDataReader dr)
|
throw new DbCslaException("AnnotationAuditInfo.Constructor", ex);
|
||||||
{
|
}
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationAuditInfo.Constructor", GetHashCode());
|
}
|
||||||
try
|
[Serializable()]
|
||||||
{
|
protected class PKCriteria
|
||||||
ReadData(dr);
|
{
|
||||||
}
|
private long _AuditID;
|
||||||
catch (Exception ex)
|
public long AuditID
|
||||||
{
|
{ get { return _AuditID; } }
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationAuditInfo.Constructor", ex);
|
public PKCriteria(long auditID)
|
||||||
throw new DbCslaException("AnnotationAuditInfo.Constructor", ex);
|
{
|
||||||
}
|
_AuditID = auditID;
|
||||||
}
|
}
|
||||||
[Serializable()]
|
}
|
||||||
protected class PKCriteria
|
private void ReadData(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
private long _AuditID;
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationAuditInfo.ReadData", GetHashCode());
|
||||||
public long AuditID
|
try
|
||||||
{ get { return _AuditID; } }
|
{
|
||||||
public PKCriteria(long auditID)
|
_AuditID = dr.GetInt64("AuditID");
|
||||||
{
|
_AnnotationID = dr.GetInt32("AnnotationID");
|
||||||
_AuditID = auditID;
|
_ItemID = dr.GetInt32("ItemID");
|
||||||
}
|
_TypeID = dr.GetInt32("TypeID");
|
||||||
}
|
_RtfText = dr.GetString("RtfText");
|
||||||
private void ReadData(SafeDataReader dr)
|
_SearchText = dr.GetString("SearchText");
|
||||||
{
|
_Config = dr.GetString("Config");
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationAuditInfo.ReadData", GetHashCode());
|
_DTS = dr.GetDateTime("DTS");
|
||||||
try
|
_UserID = dr.GetString("UserID");
|
||||||
{
|
_DeleteStatus = dr.GetInt32("DeleteStatus");
|
||||||
_AuditID = dr.GetInt64("AuditID");
|
}
|
||||||
_AnnotationID = dr.GetInt32("AnnotationID");
|
catch (Exception ex)
|
||||||
_ItemID = dr.GetInt32("ItemID");
|
{
|
||||||
_TypeID = dr.GetInt32("TypeID");
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationAuditInfo.ReadData", ex);
|
||||||
_RtfText = dr.GetString("RtfText");
|
_ErrorMessage = ex.Message;
|
||||||
_SearchText = dr.GetString("SearchText");
|
throw new DbCslaException("AnnotationAuditInfo.ReadData", ex);
|
||||||
_Config = dr.GetString("Config");
|
}
|
||||||
_DTS = dr.GetDateTime("DTS");
|
}
|
||||||
_UserID = dr.GetString("UserID");
|
private void DataPortal_Fetch(PKCriteria criteria)
|
||||||
_DeleteStatus = dr.GetInt32("DeleteStatus");
|
{
|
||||||
}
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationAuditInfo.DataPortal_Fetch", GetHashCode());
|
||||||
catch (Exception ex)
|
try
|
||||||
{
|
{
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationAuditInfo.ReadData", ex);
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
_ErrorMessage = ex.Message;
|
{
|
||||||
throw new DbCslaException("AnnotationAuditInfo.ReadData", ex);
|
ApplicationContext.LocalContext["cn"] = cn;
|
||||||
}
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
}
|
{
|
||||||
private void DataPortal_Fetch(PKCriteria criteria)
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
{
|
cm.CommandText = "getAnnotationAudit";
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationAuditInfo.DataPortal_Fetch", GetHashCode());
|
cm.Parameters.AddWithValue("@AuditID", criteria.AuditID);
|
||||||
try
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
{
|
{
|
||||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
if (!dr.Read())
|
||||||
{
|
{
|
||||||
ApplicationContext.LocalContext["cn"] = cn;
|
_ErrorMessage = "No Record Found";
|
||||||
using (SqlCommand cm = cn.CreateCommand())
|
return;
|
||||||
{
|
}
|
||||||
cm.CommandType = CommandType.StoredProcedure;
|
ReadData(dr);
|
||||||
cm.CommandText = "getAnnotationAudit";
|
}
|
||||||
cm.Parameters.AddWithValue("@AuditID", criteria.AuditID);
|
}
|
||||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
// removing of item only needed for local data portal
|
||||||
{
|
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
||||||
if (!dr.Read())
|
ApplicationContext.LocalContext.Remove("cn");
|
||||||
{
|
}
|
||||||
_ErrorMessage = "No Record Found";
|
}
|
||||||
return;
|
catch (Exception ex)
|
||||||
}
|
{
|
||||||
ReadData(dr);
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationAuditInfo.DataPortal_Fetch", ex);
|
||||||
}
|
_ErrorMessage = ex.Message;
|
||||||
}
|
throw new DbCslaException("AnnotationAuditInfo.DataPortal_Fetch", ex);
|
||||||
// removing of item only needed for local data portal
|
}
|
||||||
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
}
|
||||||
ApplicationContext.LocalContext.Remove("cn");
|
#endregion
|
||||||
}
|
// Standard Refresh
|
||||||
}
|
#region extension
|
||||||
catch (Exception ex)
|
AnnotationAuditInfoExtension _AnnotationAuditInfoExtension = new AnnotationAuditInfoExtension();
|
||||||
{
|
[Serializable()]
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationAuditInfo.DataPortal_Fetch", ex);
|
partial class AnnotationAuditInfoExtension : extensionBase { }
|
||||||
_ErrorMessage = ex.Message;
|
[Serializable()]
|
||||||
throw new DbCslaException("AnnotationAuditInfo.DataPortal_Fetch", ex);
|
class extensionBase
|
||||||
}
|
{
|
||||||
}
|
// Default Refresh
|
||||||
#endregion
|
public virtual void Refresh(AnnotationAuditInfo tmp) { }
|
||||||
// Standard Refresh
|
}
|
||||||
#region extension
|
#endregion
|
||||||
AnnotationAuditInfoExtension _AnnotationAuditInfoExtension = new AnnotationAuditInfoExtension();
|
} // Class
|
||||||
[Serializable()]
|
#region Converter
|
||||||
partial class AnnotationAuditInfoExtension : extensionBase { }
|
internal class AnnotationAuditInfoConverter : ExpandableObjectConverter
|
||||||
[Serializable()]
|
{
|
||||||
class extensionBase
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
{
|
{
|
||||||
// Default Refresh
|
if (destType == typeof(string) && value is AnnotationAuditInfo)
|
||||||
public virtual void Refresh(AnnotationAuditInfo tmp) { }
|
{
|
||||||
}
|
// Return the ToString value
|
||||||
#endregion
|
return ((AnnotationAuditInfo)value).ToString();
|
||||||
} // Class
|
}
|
||||||
#region Converter
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
internal class AnnotationAuditInfoConverter : ExpandableObjectConverter
|
}
|
||||||
{
|
}
|
||||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
#endregion
|
||||||
{
|
|
||||||
if (destType == typeof(string) && value is AnnotationAuditInfo)
|
|
||||||
{
|
|
||||||
// Return the ToString value
|
|
||||||
return ((AnnotationAuditInfo)value).ToString();
|
|
||||||
}
|
|
||||||
return base.ConvertTo(context, culture, value, destType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -19,376 +19,366 @@ using System.ComponentModel;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
public delegate void ContentAuditInfoEvent(object sender);
|
public delegate void ContentAuditInfoEvent(object sender);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ContentAuditInfo Generated by MyGeneration using the CSLA Object Mapping template
|
/// ContentAuditInfo Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
[TypeConverter(typeof(ContentAuditInfoConverter))]
|
[TypeConverter(typeof(ContentAuditInfoConverter))]
|
||||||
public partial class ContentAuditInfo : ReadOnlyBase<ContentAuditInfo>, IDisposable
|
public partial class ContentAuditInfo : ReadOnlyBase<ContentAuditInfo>, IDisposable
|
||||||
{
|
{
|
||||||
public event ContentAuditInfoEvent Changed;
|
public event ContentAuditInfoEvent Changed;
|
||||||
private void OnChange()
|
private void OnChange()
|
||||||
{
|
{
|
||||||
if (Changed != null) Changed(this);
|
if (Changed != null) Changed(this);
|
||||||
}
|
}
|
||||||
#region Log4Net
|
#region Log4Net
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
private static List<ContentAuditInfo> _CacheList = new List<ContentAuditInfo>();
|
private static List<ContentAuditInfo> _CacheList = new List<ContentAuditInfo>();
|
||||||
protected static void AddToCache(ContentAuditInfo contentAuditInfo)
|
protected static void AddToCache(ContentAuditInfo contentAuditInfo)
|
||||||
{
|
{
|
||||||
if (!_CacheList.Contains(contentAuditInfo)) _CacheList.Add(contentAuditInfo); // In AddToCache
|
if (!_CacheList.Contains(contentAuditInfo)) _CacheList.Add(contentAuditInfo); // In AddToCache
|
||||||
}
|
}
|
||||||
protected static void RemoveFromCache(ContentAuditInfo contentAuditInfo)
|
protected static void RemoveFromCache(ContentAuditInfo contentAuditInfo)
|
||||||
{
|
{
|
||||||
while (_CacheList.Contains(contentAuditInfo)) _CacheList.Remove(contentAuditInfo); // In RemoveFromCache
|
while (_CacheList.Contains(contentAuditInfo)) _CacheList.Remove(contentAuditInfo); // In RemoveFromCache
|
||||||
}
|
}
|
||||||
private static Dictionary<string, List<ContentAuditInfo>> _CacheByPrimaryKey = new Dictionary<string, List<ContentAuditInfo>>();
|
private static Dictionary<string, List<ContentAuditInfo>> _CacheByPrimaryKey = new Dictionary<string, List<ContentAuditInfo>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
while (_CacheList.Count > 0) // Move ContentAuditInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
while (_CacheList.Count > 0) // Move ContentAuditInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
||||||
{
|
{
|
||||||
ContentAuditInfo tmp = _CacheList[0]; // Get the first ContentAuditInfo
|
ContentAuditInfo tmp = _CacheList[0]; // Get the first ContentAuditInfo
|
||||||
string pKey = tmp.AuditID.ToString();
|
string pKey = tmp.AuditID.ToString();
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
||||||
{
|
{
|
||||||
_CacheByPrimaryKey[pKey] = new List<ContentAuditInfo>(); // Add new list for PrimaryKey
|
_CacheByPrimaryKey[pKey] = new List<ContentAuditInfo>(); // Add new list for PrimaryKey
|
||||||
}
|
}
|
||||||
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
||||||
_CacheList.RemoveAt(0); // Remove the first ContentAuditInfo
|
_CacheList.RemoveAt(0); // Remove the first ContentAuditInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
internal static void AddList(ContentAuditInfoList lst)
|
internal static void AddList(ContentAuditInfoList lst)
|
||||||
{
|
{
|
||||||
foreach (ContentAuditInfo item in lst) AddToCache(item);
|
foreach (ContentAuditInfo item in lst) AddToCache(item);
|
||||||
}
|
}
|
||||||
protected static ContentAuditInfo GetCachedByPrimaryKey(long auditID)
|
protected static ContentAuditInfo GetCachedByPrimaryKey(long auditID)
|
||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = auditID.ToString();
|
string key = auditID.ToString();
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Business Methods
|
#region Business Methods
|
||||||
private string _ErrorMessage = string.Empty;
|
private string _ErrorMessage = string.Empty;
|
||||||
public string ErrorMessage
|
public string ErrorMessage
|
||||||
{
|
{
|
||||||
get { return _ErrorMessage; }
|
get { return _ErrorMessage; }
|
||||||
}
|
}
|
||||||
protected ContentAudit _Editable;
|
protected ContentAudit _Editable;
|
||||||
private IVEHasBrokenRules HasBrokenRules
|
private IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
IVEHasBrokenRules hasBrokenRules = null;
|
IVEHasBrokenRules hasBrokenRules = null;
|
||||||
if (_Editable != null)
|
if (_Editable != null)
|
||||||
hasBrokenRules = _Editable.HasBrokenRules;
|
hasBrokenRules = _Editable.HasBrokenRules;
|
||||||
return hasBrokenRules;
|
return hasBrokenRules;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private long _AuditID;
|
private long _AuditID;
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
public long AuditID
|
public long AuditID
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("AuditID", true);
|
return _AuditID;
|
||||||
return _AuditID;
|
}
|
||||||
}
|
}
|
||||||
}
|
private int _ContentID;
|
||||||
private int _ContentID;
|
public int ContentID
|
||||||
public int ContentID
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
get
|
||||||
get
|
{
|
||||||
{
|
return _ContentID;
|
||||||
CanReadProperty("ContentID", true);
|
}
|
||||||
return _ContentID;
|
}
|
||||||
}
|
private string _Number = string.Empty;
|
||||||
}
|
public string Number
|
||||||
private string _Number = string.Empty;
|
{
|
||||||
public string Number
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
return _Number;
|
||||||
{
|
}
|
||||||
CanReadProperty("Number", true);
|
}
|
||||||
return _Number;
|
private string _Text = string.Empty;
|
||||||
}
|
public string Text
|
||||||
}
|
{
|
||||||
private string _Text = string.Empty;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
public string Text
|
get
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
return _Text;
|
||||||
get
|
}
|
||||||
{
|
}
|
||||||
CanReadProperty("Text", true);
|
private int? _Type;
|
||||||
return _Text;
|
public int? Type
|
||||||
}
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
private int? _Type;
|
get
|
||||||
public int? Type
|
{
|
||||||
{
|
return _Type;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
}
|
||||||
{
|
private int? _FormatID;
|
||||||
CanReadProperty("Type", true);
|
public int? FormatID
|
||||||
return _Type;
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
private int? _FormatID;
|
{
|
||||||
public int? FormatID
|
return _FormatID;
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
private string _Config = string.Empty;
|
||||||
{
|
public string Config
|
||||||
CanReadProperty("FormatID", true);
|
{
|
||||||
return _FormatID;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
}
|
{
|
||||||
private string _Config = string.Empty;
|
return _Config;
|
||||||
public string Config
|
}
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
private DateTime _DTS = new DateTime();
|
||||||
get
|
public DateTime DTS
|
||||||
{
|
{
|
||||||
CanReadProperty("Config", true);
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
return _Config;
|
get
|
||||||
}
|
{
|
||||||
}
|
return _DTS;
|
||||||
private DateTime _DTS = new DateTime();
|
}
|
||||||
public DateTime DTS
|
}
|
||||||
{
|
private string _UserID = string.Empty;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
public string UserID
|
||||||
get
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
CanReadProperty("DTS", true);
|
get
|
||||||
return _DTS;
|
{
|
||||||
}
|
return _UserID;
|
||||||
}
|
}
|
||||||
private string _UserID = string.Empty;
|
}
|
||||||
public string UserID
|
private int _DeleteStatus;
|
||||||
{
|
public int DeleteStatus
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
CanReadProperty("UserID", true);
|
{
|
||||||
return _UserID;
|
return _DeleteStatus;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private int _DeleteStatus;
|
// CSLATODO: Replace base ContentAuditInfo.ToString function as necessary
|
||||||
public int DeleteStatus
|
/// <summary>
|
||||||
{
|
/// Overrides Base ToString
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
/// </summary>
|
||||||
get
|
/// <returns>A string representation of current ContentAuditInfo</returns>
|
||||||
{
|
//public override string ToString()
|
||||||
CanReadProperty("DeleteStatus", true);
|
//{
|
||||||
return _DeleteStatus;
|
// return base.ToString();
|
||||||
}
|
//}
|
||||||
}
|
// CSLATODO: Check ContentAuditInfo.GetIdValue to assure that the ID returned is unique
|
||||||
// CSLATODO: Replace base ContentAuditInfo.ToString function as necessary
|
/// <summary>
|
||||||
/// <summary>
|
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||||
/// Overrides Base ToString
|
/// </summary>
|
||||||
/// </summary>
|
/// <returns>A Unique ID for the current ContentAuditInfo</returns>
|
||||||
/// <returns>A string representation of current ContentAuditInfo</returns>
|
protected override object GetIdValue()
|
||||||
//public override string ToString()
|
{
|
||||||
//{
|
return MyContentAuditInfoUnique; // Absolutely Unique ID
|
||||||
// return base.ToString();
|
}
|
||||||
//}
|
#endregion
|
||||||
// CSLATODO: Check ContentAuditInfo.GetIdValue to assure that the ID returned is unique
|
#region Factory Methods
|
||||||
/// <summary>
|
private static int _ContentAuditInfoUnique = 0;
|
||||||
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
private static int ContentAuditInfoUnique
|
||||||
/// </summary>
|
{ get { return ++_ContentAuditInfoUnique; } }
|
||||||
/// <returns>A Unique ID for the current ContentAuditInfo</returns>
|
private int _MyContentAuditInfoUnique = ContentAuditInfoUnique;
|
||||||
protected override object GetIdValue()
|
public int MyContentAuditInfoUnique // Absolutely Unique ID - Info
|
||||||
{
|
{ get { return _MyContentAuditInfoUnique; } }
|
||||||
return MyContentAuditInfoUnique; // Absolutely Unique ID
|
protected ContentAuditInfo()
|
||||||
}
|
{/* require use of factory methods */
|
||||||
#endregion
|
AddToCache(this);
|
||||||
#region Factory Methods
|
}
|
||||||
private static int _ContentAuditInfoUnique = 0;
|
public void Dispose()
|
||||||
private static int ContentAuditInfoUnique
|
{
|
||||||
{ get { return ++_ContentAuditInfoUnique; } }
|
RemoveFromCache(this);
|
||||||
private int _MyContentAuditInfoUnique = ContentAuditInfoUnique;
|
if (!_CacheByPrimaryKey.ContainsKey(AuditID.ToString())) return;
|
||||||
public int MyContentAuditInfoUnique // Absolutely Unique ID - Info
|
List<ContentAuditInfo> listContentAuditInfo = _CacheByPrimaryKey[AuditID.ToString()]; // Get the list of items
|
||||||
{ get { return _MyContentAuditInfoUnique; } }
|
while (listContentAuditInfo.Contains(this)) listContentAuditInfo.Remove(this); // Remove the item from the list
|
||||||
protected ContentAuditInfo()
|
if (listContentAuditInfo.Count == 0) // If there are no items left in the list
|
||||||
{/* require use of factory methods */
|
_CacheByPrimaryKey.Remove(AuditID.ToString()); // remove the list
|
||||||
AddToCache(this);
|
}
|
||||||
}
|
public virtual ContentAudit Get()
|
||||||
public void Dispose()
|
{
|
||||||
{
|
return _Editable = ContentAudit.Get(_AuditID);
|
||||||
RemoveFromCache(this);
|
}
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(AuditID.ToString())) return;
|
public static void Refresh(ContentAudit tmp)
|
||||||
List<ContentAuditInfo> listContentAuditInfo = _CacheByPrimaryKey[AuditID.ToString()]; // Get the list of items
|
{
|
||||||
while (listContentAuditInfo.Contains(this)) listContentAuditInfo.Remove(this); // Remove the item from the list
|
string key = tmp.AuditID.ToString();
|
||||||
if (listContentAuditInfo.Count == 0) // If there are no items left in the list
|
ConvertListToDictionary();
|
||||||
_CacheByPrimaryKey.Remove(AuditID.ToString()); // remove the list
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
}
|
foreach (ContentAuditInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
public virtual ContentAudit Get()
|
tmpInfo.RefreshFields(tmp);
|
||||||
{
|
}
|
||||||
return _Editable = ContentAudit.Get(_AuditID);
|
protected virtual void RefreshFields(ContentAudit tmp)
|
||||||
}
|
{
|
||||||
public static void Refresh(ContentAudit tmp)
|
_ContentID = tmp.ContentID;
|
||||||
{
|
_Number = tmp.Number;
|
||||||
string key = tmp.AuditID.ToString();
|
_Text = tmp.Text;
|
||||||
ConvertListToDictionary();
|
_Type = tmp.Type;
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
_FormatID = tmp.FormatID;
|
||||||
foreach (ContentAuditInfo tmpInfo in _CacheByPrimaryKey[key])
|
_Config = tmp.Config;
|
||||||
tmpInfo.RefreshFields(tmp);
|
_DTS = tmp.DTS;
|
||||||
}
|
_UserID = tmp.UserID;
|
||||||
protected virtual void RefreshFields(ContentAudit tmp)
|
_DeleteStatus = tmp.DeleteStatus;
|
||||||
{
|
_ContentAuditInfoExtension.Refresh(this);
|
||||||
_ContentID = tmp.ContentID;
|
OnChange();// raise an event
|
||||||
_Number = tmp.Number;
|
}
|
||||||
_Text = tmp.Text;
|
public static ContentAuditInfo Get(long auditID)
|
||||||
_Type = tmp.Type;
|
{
|
||||||
_FormatID = tmp.FormatID;
|
//if (!CanGetObject())
|
||||||
_Config = tmp.Config;
|
// throw new System.Security.SecurityException("User not authorized to view a ContentAudit");
|
||||||
_DTS = tmp.DTS;
|
try
|
||||||
_UserID = tmp.UserID;
|
{
|
||||||
_DeleteStatus = tmp.DeleteStatus;
|
ContentAuditInfo tmp = GetCachedByPrimaryKey(auditID);
|
||||||
_ContentAuditInfoExtension.Refresh(this);
|
if (tmp == null)
|
||||||
OnChange();// raise an event
|
{
|
||||||
}
|
tmp = DataPortal.Fetch<ContentAuditInfo>(new PKCriteria(auditID));
|
||||||
public static ContentAuditInfo Get(long auditID)
|
AddToCache(tmp);
|
||||||
{
|
}
|
||||||
//if (!CanGetObject())
|
if (tmp.ErrorMessage == "No Record Found")
|
||||||
// throw new System.Security.SecurityException("User not authorized to view a ContentAudit");
|
{
|
||||||
try
|
tmp.Dispose(); // Clean-up ContentAuditInfo
|
||||||
{
|
tmp = null;
|
||||||
ContentAuditInfo tmp = GetCachedByPrimaryKey(auditID);
|
}
|
||||||
if (tmp == null)
|
return tmp;
|
||||||
{
|
}
|
||||||
tmp = DataPortal.Fetch<ContentAuditInfo>(new PKCriteria(auditID));
|
catch (Exception ex)
|
||||||
AddToCache(tmp);
|
{
|
||||||
}
|
throw new DbCslaException("Error on ContentAuditInfo.Get", ex);
|
||||||
if (tmp.ErrorMessage == "No Record Found")
|
}
|
||||||
{
|
}
|
||||||
tmp.Dispose(); // Clean-up ContentAuditInfo
|
#endregion
|
||||||
tmp = null;
|
#region Data Access Portal
|
||||||
}
|
internal ContentAuditInfo(SafeDataReader dr)
|
||||||
return tmp;
|
{
|
||||||
}
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentAuditInfo.Constructor", GetHashCode());
|
||||||
catch (Exception ex)
|
try
|
||||||
{
|
{
|
||||||
throw new DbCslaException("Error on ContentAuditInfo.Get", ex);
|
ReadData(dr);
|
||||||
}
|
}
|
||||||
}
|
catch (Exception ex)
|
||||||
#endregion
|
{
|
||||||
#region Data Access Portal
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentAuditInfo.Constructor", ex);
|
||||||
internal ContentAuditInfo(SafeDataReader dr)
|
throw new DbCslaException("ContentAuditInfo.Constructor", ex);
|
||||||
{
|
}
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentAuditInfo.Constructor", GetHashCode());
|
}
|
||||||
try
|
[Serializable()]
|
||||||
{
|
protected class PKCriteria
|
||||||
ReadData(dr);
|
{
|
||||||
}
|
private long _AuditID;
|
||||||
catch (Exception ex)
|
public long AuditID
|
||||||
{
|
{ get { return _AuditID; } }
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentAuditInfo.Constructor", ex);
|
public PKCriteria(long auditID)
|
||||||
throw new DbCslaException("ContentAuditInfo.Constructor", ex);
|
{
|
||||||
}
|
_AuditID = auditID;
|
||||||
}
|
}
|
||||||
[Serializable()]
|
}
|
||||||
protected class PKCriteria
|
private void ReadData(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
private long _AuditID;
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentAuditInfo.ReadData", GetHashCode());
|
||||||
public long AuditID
|
try
|
||||||
{ get { return _AuditID; } }
|
{
|
||||||
public PKCriteria(long auditID)
|
_AuditID = dr.GetInt64("AuditID");
|
||||||
{
|
_ContentID = dr.GetInt32("ContentID");
|
||||||
_AuditID = auditID;
|
_Number = dr.GetString("Number");
|
||||||
}
|
_Text = dr.GetString("Text");
|
||||||
}
|
_Type = (int?)dr.GetValue("Type");
|
||||||
private void ReadData(SafeDataReader dr)
|
_FormatID = (int?)dr.GetValue("FormatID");
|
||||||
{
|
_Config = dr.GetString("Config");
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentAuditInfo.ReadData", GetHashCode());
|
_DTS = dr.GetDateTime("DTS");
|
||||||
try
|
_UserID = dr.GetString("UserID");
|
||||||
{
|
_DeleteStatus = dr.GetInt32("DeleteStatus");
|
||||||
_AuditID = dr.GetInt64("AuditID");
|
}
|
||||||
_ContentID = dr.GetInt32("ContentID");
|
catch (Exception ex)
|
||||||
_Number = dr.GetString("Number");
|
{
|
||||||
_Text = dr.GetString("Text");
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentAuditInfo.ReadData", ex);
|
||||||
_Type = (int?)dr.GetValue("Type");
|
_ErrorMessage = ex.Message;
|
||||||
_FormatID = (int?)dr.GetValue("FormatID");
|
throw new DbCslaException("ContentAuditInfo.ReadData", ex);
|
||||||
_Config = dr.GetString("Config");
|
}
|
||||||
_DTS = dr.GetDateTime("DTS");
|
}
|
||||||
_UserID = dr.GetString("UserID");
|
private void DataPortal_Fetch(PKCriteria criteria)
|
||||||
_DeleteStatus = dr.GetInt32("DeleteStatus");
|
{
|
||||||
}
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentAuditInfo.DataPortal_Fetch", GetHashCode());
|
||||||
catch (Exception ex)
|
try
|
||||||
{
|
{
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentAuditInfo.ReadData", ex);
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
_ErrorMessage = ex.Message;
|
{
|
||||||
throw new DbCslaException("ContentAuditInfo.ReadData", ex);
|
ApplicationContext.LocalContext["cn"] = cn;
|
||||||
}
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
}
|
{
|
||||||
private void DataPortal_Fetch(PKCriteria criteria)
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
{
|
cm.CommandText = "getContentAudit";
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentAuditInfo.DataPortal_Fetch", GetHashCode());
|
cm.Parameters.AddWithValue("@AuditID", criteria.AuditID);
|
||||||
try
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
{
|
{
|
||||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
if (!dr.Read())
|
||||||
{
|
{
|
||||||
ApplicationContext.LocalContext["cn"] = cn;
|
_ErrorMessage = "No Record Found";
|
||||||
using (SqlCommand cm = cn.CreateCommand())
|
return;
|
||||||
{
|
}
|
||||||
cm.CommandType = CommandType.StoredProcedure;
|
ReadData(dr);
|
||||||
cm.CommandText = "getContentAudit";
|
}
|
||||||
cm.Parameters.AddWithValue("@AuditID", criteria.AuditID);
|
}
|
||||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
// removing of item only needed for local data portal
|
||||||
{
|
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
||||||
if (!dr.Read())
|
ApplicationContext.LocalContext.Remove("cn");
|
||||||
{
|
}
|
||||||
_ErrorMessage = "No Record Found";
|
}
|
||||||
return;
|
catch (Exception ex)
|
||||||
}
|
{
|
||||||
ReadData(dr);
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentAuditInfo.DataPortal_Fetch", ex);
|
||||||
}
|
_ErrorMessage = ex.Message;
|
||||||
}
|
throw new DbCslaException("ContentAuditInfo.DataPortal_Fetch", ex);
|
||||||
// removing of item only needed for local data portal
|
}
|
||||||
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
}
|
||||||
ApplicationContext.LocalContext.Remove("cn");
|
#endregion
|
||||||
}
|
// Standard Refresh
|
||||||
}
|
#region extension
|
||||||
catch (Exception ex)
|
ContentAuditInfoExtension _ContentAuditInfoExtension = new ContentAuditInfoExtension();
|
||||||
{
|
[Serializable()]
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentAuditInfo.DataPortal_Fetch", ex);
|
partial class ContentAuditInfoExtension : extensionBase { }
|
||||||
_ErrorMessage = ex.Message;
|
[Serializable()]
|
||||||
throw new DbCslaException("ContentAuditInfo.DataPortal_Fetch", ex);
|
class extensionBase
|
||||||
}
|
{
|
||||||
}
|
// Default Refresh
|
||||||
#endregion
|
public virtual void Refresh(ContentAuditInfo tmp) { }
|
||||||
// Standard Refresh
|
}
|
||||||
#region extension
|
#endregion
|
||||||
ContentAuditInfoExtension _ContentAuditInfoExtension = new ContentAuditInfoExtension();
|
} // Class
|
||||||
[Serializable()]
|
#region Converter
|
||||||
partial class ContentAuditInfoExtension : extensionBase { }
|
internal class ContentAuditInfoConverter : ExpandableObjectConverter
|
||||||
[Serializable()]
|
{
|
||||||
class extensionBase
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
{
|
{
|
||||||
// Default Refresh
|
if (destType == typeof(string) && value is ContentAuditInfo)
|
||||||
public virtual void Refresh(ContentAuditInfo tmp) { }
|
{
|
||||||
}
|
// Return the ToString value
|
||||||
#endregion
|
return ((ContentAuditInfo)value).ToString();
|
||||||
} // Class
|
}
|
||||||
#region Converter
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
internal class ContentAuditInfoConverter : ExpandableObjectConverter
|
}
|
||||||
{
|
}
|
||||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
#endregion
|
||||||
{
|
|
||||||
if (destType == typeof(string) && value is ContentAuditInfo)
|
|
||||||
{
|
|
||||||
// Return the ToString value
|
|
||||||
return ((ContentAuditInfo)value).ToString();
|
|
||||||
}
|
|
||||||
return base.ConvertTo(context, culture, value, destType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -19,388 +19,377 @@ using System.ComponentModel;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
public delegate void DocumentAuditInfoEvent(object sender);
|
public delegate void DocumentAuditInfoEvent(object sender);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// DocumentAuditInfo Generated by MyGeneration using the CSLA Object Mapping template
|
/// DocumentAuditInfo Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
[TypeConverter(typeof(DocumentAuditInfoConverter))]
|
[TypeConverter(typeof(DocumentAuditInfoConverter))]
|
||||||
public partial class DocumentAuditInfo : ReadOnlyBase<DocumentAuditInfo>, IDisposable
|
public partial class DocumentAuditInfo : ReadOnlyBase<DocumentAuditInfo>, IDisposable
|
||||||
{
|
{
|
||||||
public event DocumentAuditInfoEvent Changed;
|
public event DocumentAuditInfoEvent Changed;
|
||||||
private void OnChange()
|
private void OnChange()
|
||||||
{
|
{
|
||||||
if (Changed != null) Changed(this);
|
if (Changed != null) Changed(this);
|
||||||
}
|
}
|
||||||
#region Log4Net
|
#region Log4Net
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
private static List<DocumentAuditInfo> _CacheList = new List<DocumentAuditInfo>();
|
private static List<DocumentAuditInfo> _CacheList = new List<DocumentAuditInfo>();
|
||||||
protected static void AddToCache(DocumentAuditInfo documentAuditInfo)
|
protected static void AddToCache(DocumentAuditInfo documentAuditInfo)
|
||||||
{
|
{
|
||||||
if (!_CacheList.Contains(documentAuditInfo)) _CacheList.Add(documentAuditInfo); // In AddToCache
|
if (!_CacheList.Contains(documentAuditInfo)) _CacheList.Add(documentAuditInfo); // In AddToCache
|
||||||
}
|
}
|
||||||
protected static void RemoveFromCache(DocumentAuditInfo documentAuditInfo)
|
protected static void RemoveFromCache(DocumentAuditInfo documentAuditInfo)
|
||||||
{
|
{
|
||||||
while (_CacheList.Contains(documentAuditInfo)) _CacheList.Remove(documentAuditInfo); // In RemoveFromCache
|
while (_CacheList.Contains(documentAuditInfo)) _CacheList.Remove(documentAuditInfo); // In RemoveFromCache
|
||||||
}
|
}
|
||||||
private static Dictionary<string, List<DocumentAuditInfo>> _CacheByPrimaryKey = new Dictionary<string, List<DocumentAuditInfo>>();
|
private static Dictionary<string, List<DocumentAuditInfo>> _CacheByPrimaryKey = new Dictionary<string, List<DocumentAuditInfo>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
while (_CacheList.Count > 0) // Move DocumentAuditInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
while (_CacheList.Count > 0) // Move DocumentAuditInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
||||||
{
|
{
|
||||||
DocumentAuditInfo tmp = _CacheList[0]; // Get the first DocumentAuditInfo
|
DocumentAuditInfo tmp = _CacheList[0]; // Get the first DocumentAuditInfo
|
||||||
string pKey = tmp.AuditID.ToString();
|
string pKey = tmp.AuditID.ToString();
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
||||||
{
|
{
|
||||||
_CacheByPrimaryKey[pKey] = new List<DocumentAuditInfo>(); // Add new list for PrimaryKey
|
_CacheByPrimaryKey[pKey] = new List<DocumentAuditInfo>(); // Add new list for PrimaryKey
|
||||||
}
|
}
|
||||||
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
||||||
_CacheList.RemoveAt(0); // Remove the first DocumentAuditInfo
|
_CacheList.RemoveAt(0); // Remove the first DocumentAuditInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
internal static void AddList(DocumentAuditInfoList lst)
|
internal static void AddList(DocumentAuditInfoList lst)
|
||||||
{
|
{
|
||||||
foreach (DocumentAuditInfo item in lst) AddToCache(item);
|
foreach (DocumentAuditInfo item in lst) AddToCache(item);
|
||||||
}
|
}
|
||||||
protected static DocumentAuditInfo GetCachedByPrimaryKey(long auditID)
|
protected static DocumentAuditInfo GetCachedByPrimaryKey(long auditID)
|
||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = auditID.ToString();
|
string key = auditID.ToString();
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Business Methods
|
#region Business Methods
|
||||||
private string _ErrorMessage = string.Empty;
|
private string _ErrorMessage = string.Empty;
|
||||||
public string ErrorMessage
|
public string ErrorMessage
|
||||||
{
|
{
|
||||||
get { return _ErrorMessage; }
|
get { return _ErrorMessage; }
|
||||||
}
|
}
|
||||||
protected DocumentAudit _Editable;
|
protected DocumentAudit _Editable;
|
||||||
private IVEHasBrokenRules HasBrokenRules
|
private IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
IVEHasBrokenRules hasBrokenRules = null;
|
IVEHasBrokenRules hasBrokenRules = null;
|
||||||
if (_Editable != null)
|
if (_Editable != null)
|
||||||
hasBrokenRules = _Editable.HasBrokenRules;
|
hasBrokenRules = _Editable.HasBrokenRules;
|
||||||
return hasBrokenRules;
|
return hasBrokenRules;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private long _AuditID;
|
private long _AuditID;
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
public long AuditID
|
public long AuditID
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("AuditID", true);
|
return _AuditID;
|
||||||
return _AuditID;
|
}
|
||||||
}
|
}
|
||||||
}
|
private int _DocID;
|
||||||
private int _DocID;
|
public int DocID
|
||||||
public int DocID
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
get
|
||||||
get
|
{
|
||||||
{
|
return _DocID;
|
||||||
CanReadProperty("DocID", true);
|
}
|
||||||
return _DocID;
|
}
|
||||||
}
|
private string _LibTitle = string.Empty;
|
||||||
}
|
public string LibTitle
|
||||||
private string _LibTitle = string.Empty;
|
{
|
||||||
public string LibTitle
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
return _LibTitle;
|
||||||
{
|
}
|
||||||
CanReadProperty("LibTitle", true);
|
}
|
||||||
return _LibTitle;
|
private byte[] _DocContent;
|
||||||
}
|
public byte[] DocContent
|
||||||
}
|
{
|
||||||
private byte[] _DocContent;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
public byte[] DocContent
|
get
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
return _DocContent;
|
||||||
get
|
}
|
||||||
{
|
}
|
||||||
CanReadProperty("DocContent", true);
|
private string _DocAscii = string.Empty;
|
||||||
return _DocContent;
|
public string DocAscii
|
||||||
}
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
private string _DocAscii = string.Empty;
|
get
|
||||||
public string DocAscii
|
{
|
||||||
{
|
return _DocAscii;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
}
|
||||||
{
|
private string _Config = string.Empty;
|
||||||
CanReadProperty("DocAscii", true);
|
public string Config
|
||||||
return _DocAscii;
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
private string _Config = string.Empty;
|
{
|
||||||
public string Config
|
return _Config;
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
private DateTime _DTS = new DateTime();
|
||||||
{
|
public DateTime DTS
|
||||||
CanReadProperty("Config", true);
|
{
|
||||||
return _Config;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
}
|
{
|
||||||
private DateTime _DTS = new DateTime();
|
return _DTS;
|
||||||
public DateTime DTS
|
}
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
private string _UserID = string.Empty;
|
||||||
get
|
public string UserID
|
||||||
{
|
{
|
||||||
CanReadProperty("DTS", true);
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
return _DTS;
|
get
|
||||||
}
|
{
|
||||||
}
|
return _UserID;
|
||||||
private string _UserID = string.Empty;
|
}
|
||||||
public string UserID
|
}
|
||||||
{
|
private string _FileExtension = string.Empty;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
public string FileExtension
|
||||||
get
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
CanReadProperty("UserID", true);
|
get
|
||||||
return _UserID;
|
{
|
||||||
}
|
return _FileExtension;
|
||||||
}
|
}
|
||||||
private string _FileExtension = string.Empty;
|
}
|
||||||
public string FileExtension
|
private byte[] _DocPdf;
|
||||||
{
|
public byte[] DocPdf
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
CanReadProperty("FileExtension", true);
|
{
|
||||||
return _FileExtension;
|
return _DocPdf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private byte[] _DocPdf;
|
private int _DeleteStatus;
|
||||||
public byte[] DocPdf
|
public int DeleteStatus
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("DocPdf", true);
|
return _DeleteStatus;
|
||||||
return _DocPdf;
|
}
|
||||||
}
|
}
|
||||||
}
|
// CSLATODO: Replace base DocumentAuditInfo.ToString function as necessary
|
||||||
private int _DeleteStatus;
|
/// <summary>
|
||||||
public int DeleteStatus
|
/// Overrides Base ToString
|
||||||
{
|
/// </summary>
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
/// <returns>A string representation of current DocumentAuditInfo</returns>
|
||||||
get
|
//public override string ToString()
|
||||||
{
|
//{
|
||||||
CanReadProperty("DeleteStatus", true);
|
// return base.ToString();
|
||||||
return _DeleteStatus;
|
//}
|
||||||
}
|
// CSLATODO: Check DocumentAuditInfo.GetIdValue to assure that the ID returned is unique
|
||||||
}
|
/// <summary>
|
||||||
// CSLATODO: Replace base DocumentAuditInfo.ToString function as necessary
|
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||||
/// <summary>
|
/// </summary>
|
||||||
/// Overrides Base ToString
|
/// <returns>A Unique ID for the current DocumentAuditInfo</returns>
|
||||||
/// </summary>
|
protected override object GetIdValue()
|
||||||
/// <returns>A string representation of current DocumentAuditInfo</returns>
|
{
|
||||||
//public override string ToString()
|
return MyDocumentAuditInfoUnique; // Absolutely Unique ID
|
||||||
//{
|
}
|
||||||
// return base.ToString();
|
#endregion
|
||||||
//}
|
#region Factory Methods
|
||||||
// CSLATODO: Check DocumentAuditInfo.GetIdValue to assure that the ID returned is unique
|
private static int _DocumentAuditInfoUnique = 0;
|
||||||
/// <summary>
|
private static int DocumentAuditInfoUnique
|
||||||
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
{ get { return ++_DocumentAuditInfoUnique; } }
|
||||||
/// </summary>
|
private int _MyDocumentAuditInfoUnique = DocumentAuditInfoUnique;
|
||||||
/// <returns>A Unique ID for the current DocumentAuditInfo</returns>
|
public int MyDocumentAuditInfoUnique // Absolutely Unique ID - Info
|
||||||
protected override object GetIdValue()
|
{ get { return _MyDocumentAuditInfoUnique; } }
|
||||||
{
|
protected DocumentAuditInfo()
|
||||||
return MyDocumentAuditInfoUnique; // Absolutely Unique ID
|
{/* require use of factory methods */
|
||||||
}
|
AddToCache(this);
|
||||||
#endregion
|
}
|
||||||
#region Factory Methods
|
public void Dispose()
|
||||||
private static int _DocumentAuditInfoUnique = 0;
|
{
|
||||||
private static int DocumentAuditInfoUnique
|
RemoveFromCache(this);
|
||||||
{ get { return ++_DocumentAuditInfoUnique; } }
|
if (!_CacheByPrimaryKey.ContainsKey(AuditID.ToString())) return;
|
||||||
private int _MyDocumentAuditInfoUnique = DocumentAuditInfoUnique;
|
List<DocumentAuditInfo> listDocumentAuditInfo = _CacheByPrimaryKey[AuditID.ToString()]; // Get the list of items
|
||||||
public int MyDocumentAuditInfoUnique // Absolutely Unique ID - Info
|
while (listDocumentAuditInfo.Contains(this)) listDocumentAuditInfo.Remove(this); // Remove the item from the list
|
||||||
{ get { return _MyDocumentAuditInfoUnique; } }
|
if (listDocumentAuditInfo.Count == 0) // If there are no items left in the list
|
||||||
protected DocumentAuditInfo()
|
_CacheByPrimaryKey.Remove(AuditID.ToString()); // remove the list
|
||||||
{/* require use of factory methods */
|
}
|
||||||
AddToCache(this);
|
public virtual DocumentAudit Get()
|
||||||
}
|
{
|
||||||
public void Dispose()
|
return _Editable = DocumentAudit.Get(_AuditID);
|
||||||
{
|
}
|
||||||
RemoveFromCache(this);
|
public static void Refresh(DocumentAudit tmp)
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(AuditID.ToString())) return;
|
{
|
||||||
List<DocumentAuditInfo> listDocumentAuditInfo = _CacheByPrimaryKey[AuditID.ToString()]; // Get the list of items
|
string key = tmp.AuditID.ToString();
|
||||||
while (listDocumentAuditInfo.Contains(this)) listDocumentAuditInfo.Remove(this); // Remove the item from the list
|
ConvertListToDictionary();
|
||||||
if (listDocumentAuditInfo.Count == 0) // If there are no items left in the list
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
_CacheByPrimaryKey.Remove(AuditID.ToString()); // remove the list
|
foreach (DocumentAuditInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
}
|
tmpInfo.RefreshFields(tmp);
|
||||||
public virtual DocumentAudit Get()
|
}
|
||||||
{
|
protected virtual void RefreshFields(DocumentAudit tmp)
|
||||||
return _Editable = DocumentAudit.Get(_AuditID);
|
{
|
||||||
}
|
_DocID = tmp.DocID;
|
||||||
public static void Refresh(DocumentAudit tmp)
|
_LibTitle = tmp.LibTitle;
|
||||||
{
|
_DocContent = tmp.DocContent;
|
||||||
string key = tmp.AuditID.ToString();
|
_DocAscii = tmp.DocAscii;
|
||||||
ConvertListToDictionary();
|
_Config = tmp.Config;
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
_DTS = tmp.DTS;
|
||||||
foreach (DocumentAuditInfo tmpInfo in _CacheByPrimaryKey[key])
|
_UserID = tmp.UserID;
|
||||||
tmpInfo.RefreshFields(tmp);
|
_FileExtension = tmp.FileExtension;
|
||||||
}
|
_DocPdf = tmp.DocPdf;
|
||||||
protected virtual void RefreshFields(DocumentAudit tmp)
|
_DeleteStatus = tmp.DeleteStatus;
|
||||||
{
|
_DocumentAuditInfoExtension.Refresh(this);
|
||||||
_DocID = tmp.DocID;
|
OnChange();// raise an event
|
||||||
_LibTitle = tmp.LibTitle;
|
}
|
||||||
_DocContent = tmp.DocContent;
|
public static DocumentAuditInfo Get(long auditID)
|
||||||
_DocAscii = tmp.DocAscii;
|
{
|
||||||
_Config = tmp.Config;
|
//if (!CanGetObject())
|
||||||
_DTS = tmp.DTS;
|
// throw new System.Security.SecurityException("User not authorized to view a DocumentAudit");
|
||||||
_UserID = tmp.UserID;
|
try
|
||||||
_FileExtension = tmp.FileExtension;
|
{
|
||||||
_DocPdf = tmp.DocPdf;
|
DocumentAuditInfo tmp = GetCachedByPrimaryKey(auditID);
|
||||||
_DeleteStatus = tmp.DeleteStatus;
|
if (tmp == null)
|
||||||
_DocumentAuditInfoExtension.Refresh(this);
|
{
|
||||||
OnChange();// raise an event
|
tmp = DataPortal.Fetch<DocumentAuditInfo>(new PKCriteria(auditID));
|
||||||
}
|
AddToCache(tmp);
|
||||||
public static DocumentAuditInfo Get(long auditID)
|
}
|
||||||
{
|
if (tmp.ErrorMessage == "No Record Found")
|
||||||
//if (!CanGetObject())
|
{
|
||||||
// throw new System.Security.SecurityException("User not authorized to view a DocumentAudit");
|
tmp.Dispose(); // Clean-up DocumentAuditInfo
|
||||||
try
|
tmp = null;
|
||||||
{
|
}
|
||||||
DocumentAuditInfo tmp = GetCachedByPrimaryKey(auditID);
|
return tmp;
|
||||||
if (tmp == null)
|
}
|
||||||
{
|
catch (Exception ex)
|
||||||
tmp = DataPortal.Fetch<DocumentAuditInfo>(new PKCriteria(auditID));
|
{
|
||||||
AddToCache(tmp);
|
throw new DbCslaException("Error on DocumentAuditInfo.Get", ex);
|
||||||
}
|
}
|
||||||
if (tmp.ErrorMessage == "No Record Found")
|
}
|
||||||
{
|
#endregion
|
||||||
tmp.Dispose(); // Clean-up DocumentAuditInfo
|
#region Data Access Portal
|
||||||
tmp = null;
|
internal DocumentAuditInfo(SafeDataReader dr)
|
||||||
}
|
{
|
||||||
return tmp;
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocumentAuditInfo.Constructor", GetHashCode());
|
||||||
}
|
try
|
||||||
catch (Exception ex)
|
{
|
||||||
{
|
ReadData(dr);
|
||||||
throw new DbCslaException("Error on DocumentAuditInfo.Get", ex);
|
}
|
||||||
}
|
catch (Exception ex)
|
||||||
}
|
{
|
||||||
#endregion
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocumentAuditInfo.Constructor", ex);
|
||||||
#region Data Access Portal
|
throw new DbCslaException("DocumentAuditInfo.Constructor", ex);
|
||||||
internal DocumentAuditInfo(SafeDataReader dr)
|
}
|
||||||
{
|
}
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocumentAuditInfo.Constructor", GetHashCode());
|
[Serializable()]
|
||||||
try
|
protected class PKCriteria
|
||||||
{
|
{
|
||||||
ReadData(dr);
|
private long _AuditID;
|
||||||
}
|
public long AuditID
|
||||||
catch (Exception ex)
|
{ get { return _AuditID; } }
|
||||||
{
|
public PKCriteria(long auditID)
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocumentAuditInfo.Constructor", ex);
|
{
|
||||||
throw new DbCslaException("DocumentAuditInfo.Constructor", ex);
|
_AuditID = auditID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[Serializable()]
|
private void ReadData(SafeDataReader dr)
|
||||||
protected class PKCriteria
|
{
|
||||||
{
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocumentAuditInfo.ReadData", GetHashCode());
|
||||||
private long _AuditID;
|
try
|
||||||
public long AuditID
|
{
|
||||||
{ get { return _AuditID; } }
|
_AuditID = dr.GetInt64("AuditID");
|
||||||
public PKCriteria(long auditID)
|
_DocID = dr.GetInt32("DocID");
|
||||||
{
|
_LibTitle = dr.GetString("LibTitle");
|
||||||
_AuditID = auditID;
|
_DocContent = (byte[])dr.GetValue("DocContent");
|
||||||
}
|
_DocAscii = dr.GetString("DocAscii");
|
||||||
}
|
_Config = dr.GetString("Config");
|
||||||
private void ReadData(SafeDataReader dr)
|
_DTS = dr.GetDateTime("DTS");
|
||||||
{
|
_UserID = dr.GetString("UserID");
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocumentAuditInfo.ReadData", GetHashCode());
|
_FileExtension = dr.GetString("FileExtension");
|
||||||
try
|
_DocPdf = (byte[])dr.GetValue("DocPdf");
|
||||||
{
|
_DeleteStatus = dr.GetInt32("DeleteStatus");
|
||||||
_AuditID = dr.GetInt64("AuditID");
|
}
|
||||||
_DocID = dr.GetInt32("DocID");
|
catch (Exception ex)
|
||||||
_LibTitle = dr.GetString("LibTitle");
|
{
|
||||||
_DocContent = (byte[])dr.GetValue("DocContent");
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocumentAuditInfo.ReadData", ex);
|
||||||
_DocAscii = dr.GetString("DocAscii");
|
_ErrorMessage = ex.Message;
|
||||||
_Config = dr.GetString("Config");
|
throw new DbCslaException("DocumentAuditInfo.ReadData", ex);
|
||||||
_DTS = dr.GetDateTime("DTS");
|
}
|
||||||
_UserID = dr.GetString("UserID");
|
}
|
||||||
_FileExtension = dr.GetString("FileExtension");
|
private void DataPortal_Fetch(PKCriteria criteria)
|
||||||
_DocPdf = (byte[])dr.GetValue("DocPdf");
|
{
|
||||||
_DeleteStatus = dr.GetInt32("DeleteStatus");
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocumentAuditInfo.DataPortal_Fetch", GetHashCode());
|
||||||
}
|
try
|
||||||
catch (Exception ex)
|
{
|
||||||
{
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocumentAuditInfo.ReadData", ex);
|
{
|
||||||
_ErrorMessage = ex.Message;
|
ApplicationContext.LocalContext["cn"] = cn;
|
||||||
throw new DbCslaException("DocumentAuditInfo.ReadData", ex);
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
}
|
{
|
||||||
}
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
private void DataPortal_Fetch(PKCriteria criteria)
|
cm.CommandText = "getDocumentAudit";
|
||||||
{
|
cm.Parameters.AddWithValue("@AuditID", criteria.AuditID);
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocumentAuditInfo.DataPortal_Fetch", GetHashCode());
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
try
|
{
|
||||||
{
|
if (!dr.Read())
|
||||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
{
|
||||||
{
|
_ErrorMessage = "No Record Found";
|
||||||
ApplicationContext.LocalContext["cn"] = cn;
|
return;
|
||||||
using (SqlCommand cm = cn.CreateCommand())
|
}
|
||||||
{
|
ReadData(dr);
|
||||||
cm.CommandType = CommandType.StoredProcedure;
|
}
|
||||||
cm.CommandText = "getDocumentAudit";
|
}
|
||||||
cm.Parameters.AddWithValue("@AuditID", criteria.AuditID);
|
// removing of item only needed for local data portal
|
||||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
||||||
{
|
ApplicationContext.LocalContext.Remove("cn");
|
||||||
if (!dr.Read())
|
}
|
||||||
{
|
}
|
||||||
_ErrorMessage = "No Record Found";
|
catch (Exception ex)
|
||||||
return;
|
{
|
||||||
}
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocumentAuditInfo.DataPortal_Fetch", ex);
|
||||||
ReadData(dr);
|
_ErrorMessage = ex.Message;
|
||||||
}
|
throw new DbCslaException("DocumentAuditInfo.DataPortal_Fetch", ex);
|
||||||
}
|
}
|
||||||
// removing of item only needed for local data portal
|
}
|
||||||
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
#endregion
|
||||||
ApplicationContext.LocalContext.Remove("cn");
|
// Standard Refresh
|
||||||
}
|
#region extension
|
||||||
}
|
DocumentAuditInfoExtension _DocumentAuditInfoExtension = new DocumentAuditInfoExtension();
|
||||||
catch (Exception ex)
|
[Serializable()]
|
||||||
{
|
partial class DocumentAuditInfoExtension : extensionBase { }
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocumentAuditInfo.DataPortal_Fetch", ex);
|
[Serializable()]
|
||||||
_ErrorMessage = ex.Message;
|
class extensionBase
|
||||||
throw new DbCslaException("DocumentAuditInfo.DataPortal_Fetch", ex);
|
{
|
||||||
}
|
// Default Refresh
|
||||||
}
|
public virtual void Refresh(DocumentAuditInfo tmp) { }
|
||||||
#endregion
|
}
|
||||||
// Standard Refresh
|
#endregion
|
||||||
#region extension
|
} // Class
|
||||||
DocumentAuditInfoExtension _DocumentAuditInfoExtension = new DocumentAuditInfoExtension();
|
#region Converter
|
||||||
[Serializable()]
|
internal class DocumentAuditInfoConverter : ExpandableObjectConverter
|
||||||
partial class DocumentAuditInfoExtension : extensionBase { }
|
{
|
||||||
[Serializable()]
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
class extensionBase
|
{
|
||||||
{
|
if (destType == typeof(string) && value is DocumentAuditInfo)
|
||||||
// Default Refresh
|
{
|
||||||
public virtual void Refresh(DocumentAuditInfo tmp) { }
|
// Return the ToString value
|
||||||
}
|
return ((DocumentAuditInfo)value).ToString();
|
||||||
#endregion
|
}
|
||||||
} // Class
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
#region Converter
|
}
|
||||||
internal class DocumentAuditInfoConverter : ExpandableObjectConverter
|
}
|
||||||
{
|
#endregion
|
||||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
|
||||||
{
|
|
||||||
if (destType == typeof(string) && value is DocumentAuditInfo)
|
|
||||||
{
|
|
||||||
// Return the ToString value
|
|
||||||
return ((DocumentAuditInfo)value).ToString();
|
|
||||||
}
|
|
||||||
return base.ConvertTo(context, culture, value, destType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -19,445 +19,436 @@ using System.ComponentModel;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
public delegate void DROUsageInfoEvent(object sender);
|
public delegate void DROUsageInfoEvent(object sender);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// DROUsageInfo Generated by MyGeneration using the CSLA Object Mapping template
|
/// DROUsageInfo Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
[TypeConverter(typeof(DROUsageInfoConverter))]
|
[TypeConverter(typeof(DROUsageInfoConverter))]
|
||||||
public partial class DROUsageInfo : ReadOnlyBase<DROUsageInfo>, IDisposable
|
public partial class DROUsageInfo : ReadOnlyBase<DROUsageInfo>, IDisposable
|
||||||
{
|
{
|
||||||
public event DROUsageInfoEvent Changed;
|
public event DROUsageInfoEvent Changed;
|
||||||
private void OnChange()
|
private void OnChange()
|
||||||
{
|
{
|
||||||
if (Changed != null) Changed(this);
|
if (Changed != null) Changed(this);
|
||||||
}
|
}
|
||||||
#region Log4Net
|
#region Log4Net
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
private static List<DROUsageInfo> _CacheList = new List<DROUsageInfo>();
|
private static List<DROUsageInfo> _CacheList = new List<DROUsageInfo>();
|
||||||
protected static void AddToCache(DROUsageInfo dROUsageInfo)
|
protected static void AddToCache(DROUsageInfo dROUsageInfo)
|
||||||
{
|
{
|
||||||
if (!_CacheList.Contains(dROUsageInfo)) _CacheList.Add(dROUsageInfo); // In AddToCache
|
if (!_CacheList.Contains(dROUsageInfo)) _CacheList.Add(dROUsageInfo); // In AddToCache
|
||||||
}
|
}
|
||||||
protected static void RemoveFromCache(DROUsageInfo dROUsageInfo)
|
protected static void RemoveFromCache(DROUsageInfo dROUsageInfo)
|
||||||
{
|
{
|
||||||
while (_CacheList.Contains(dROUsageInfo)) _CacheList.Remove(dROUsageInfo); // In RemoveFromCache
|
while (_CacheList.Contains(dROUsageInfo)) _CacheList.Remove(dROUsageInfo); // In RemoveFromCache
|
||||||
}
|
}
|
||||||
private static Dictionary<string, List<DROUsageInfo>> _CacheByPrimaryKey = new Dictionary<string, List<DROUsageInfo>>();
|
private static Dictionary<string, List<DROUsageInfo>> _CacheByPrimaryKey = new Dictionary<string, List<DROUsageInfo>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
while (_CacheList.Count > 0) // Move DROUsageInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
while (_CacheList.Count > 0) // Move DROUsageInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
||||||
{
|
{
|
||||||
DROUsageInfo tmp = _CacheList[0]; // Get the first DROUsageInfo
|
DROUsageInfo tmp = _CacheList[0]; // Get the first DROUsageInfo
|
||||||
string pKey = tmp.DROUsageID.ToString();
|
string pKey = tmp.DROUsageID.ToString();
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
||||||
{
|
{
|
||||||
_CacheByPrimaryKey[pKey] = new List<DROUsageInfo>(); // Add new list for PrimaryKey
|
_CacheByPrimaryKey[pKey] = new List<DROUsageInfo>(); // Add new list for PrimaryKey
|
||||||
}
|
}
|
||||||
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
||||||
_CacheList.RemoveAt(0); // Remove the first DROUsageInfo
|
_CacheList.RemoveAt(0); // Remove the first DROUsageInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
internal static void AddList(DROUsageInfoList lst)
|
internal static void AddList(DROUsageInfoList lst)
|
||||||
{
|
{
|
||||||
foreach (DROUsageInfo item in lst) AddToCache(item);
|
foreach (DROUsageInfo item in lst) AddToCache(item);
|
||||||
}
|
}
|
||||||
protected static DROUsageInfo GetCachedByPrimaryKey(int dROUsageID)
|
protected static DROUsageInfo GetCachedByPrimaryKey(int dROUsageID)
|
||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = dROUsageID.ToString();
|
string key = dROUsageID.ToString();
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Business Methods
|
#region Business Methods
|
||||||
private string _ErrorMessage = string.Empty;
|
private string _ErrorMessage = string.Empty;
|
||||||
public string ErrorMessage
|
public string ErrorMessage
|
||||||
{
|
{
|
||||||
get { return _ErrorMessage; }
|
get { return _ErrorMessage; }
|
||||||
}
|
}
|
||||||
protected DROUsage _Editable;
|
protected DROUsage _Editable;
|
||||||
private IVEHasBrokenRules HasBrokenRules
|
private IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
IVEHasBrokenRules hasBrokenRules = null;
|
IVEHasBrokenRules hasBrokenRules = null;
|
||||||
if (_Editable != null)
|
if (_Editable != null)
|
||||||
hasBrokenRules = _Editable.HasBrokenRules;
|
hasBrokenRules = _Editable.HasBrokenRules;
|
||||||
return hasBrokenRules;
|
return hasBrokenRules;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private int _DROUsageID;
|
private int _DROUsageID;
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
public int DROUsageID
|
public int DROUsageID
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("DROUsageID", true);
|
return _DROUsageID;
|
||||||
return _DROUsageID;
|
}
|
||||||
}
|
}
|
||||||
}
|
private int _DocID;
|
||||||
private int _DocID;
|
public int DocID
|
||||||
public int DocID
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
get
|
||||||
get
|
{
|
||||||
{
|
if (_MyDocument != null) _DocID = _MyDocument.DocID;
|
||||||
CanReadProperty("DocID", true);
|
return _DocID;
|
||||||
if (_MyDocument != null) _DocID = _MyDocument.DocID;
|
}
|
||||||
return _DocID;
|
}
|
||||||
}
|
private DocumentInfo _MyDocument;
|
||||||
}
|
public DocumentInfo MyDocument
|
||||||
private DocumentInfo _MyDocument;
|
{
|
||||||
public DocumentInfo MyDocument
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
if (_MyDocument == null && _DocID != 0) _MyDocument = DocumentInfo.Get(_DocID);
|
||||||
{
|
return _MyDocument;
|
||||||
CanReadProperty("MyDocument", true);
|
}
|
||||||
if (_MyDocument == null && _DocID != 0) _MyDocument = DocumentInfo.Get(_DocID);
|
}
|
||||||
return _MyDocument;
|
private string _ROID = string.Empty;
|
||||||
}
|
public string ROID
|
||||||
}
|
{
|
||||||
private string _ROID = string.Empty;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
public string ROID
|
get
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
return _ROID;
|
||||||
get
|
}
|
||||||
{
|
}
|
||||||
CanReadProperty("ROID", true);
|
private string _Config = string.Empty;
|
||||||
return _ROID;
|
public string Config
|
||||||
}
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
private string _Config = string.Empty;
|
get
|
||||||
public string Config
|
{
|
||||||
{
|
return _Config;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
}
|
||||||
{
|
private DateTime _DTS = new DateTime();
|
||||||
CanReadProperty("Config", true);
|
public DateTime DTS
|
||||||
return _Config;
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
private DateTime _DTS = new DateTime();
|
{
|
||||||
public DateTime DTS
|
return _DTS;
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
private string _UserID = string.Empty;
|
||||||
{
|
public string UserID
|
||||||
CanReadProperty("DTS", true);
|
{
|
||||||
return _DTS;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
}
|
{
|
||||||
private string _UserID = string.Empty;
|
return _UserID;
|
||||||
public string UserID
|
}
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
private int _RODbID;
|
||||||
get
|
public int RODbID
|
||||||
{
|
{
|
||||||
CanReadProperty("UserID", true);
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
return _UserID;
|
get
|
||||||
}
|
{
|
||||||
}
|
if (_MyRODb != null) _RODbID = _MyRODb.RODbID;
|
||||||
private int _RODbID;
|
return _RODbID;
|
||||||
public int RODbID
|
}
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
private RODbInfo _MyRODb;
|
||||||
get
|
public RODbInfo MyRODb
|
||||||
{
|
{
|
||||||
CanReadProperty("RODbID", true);
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
if (_MyRODb != null) _RODbID = _MyRODb.RODbID;
|
get
|
||||||
return _RODbID;
|
{
|
||||||
}
|
if (_MyRODb == null && _RODbID != 0) _MyRODb = RODbInfo.Get(_RODbID);
|
||||||
}
|
return _MyRODb;
|
||||||
private RODbInfo _MyRODb;
|
}
|
||||||
public RODbInfo MyRODb
|
}
|
||||||
{
|
// CSLATODO: Replace base DROUsageInfo.ToString function as necessary
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
/// <summary>
|
||||||
get
|
/// Overrides Base ToString
|
||||||
{
|
/// </summary>
|
||||||
CanReadProperty("MyRODb", true);
|
/// <returns>A string representation of current DROUsageInfo</returns>
|
||||||
if (_MyRODb == null && _RODbID != 0) _MyRODb = RODbInfo.Get(_RODbID);
|
//public override string ToString()
|
||||||
return _MyRODb;
|
//{
|
||||||
}
|
// return base.ToString();
|
||||||
}
|
//}
|
||||||
// CSLATODO: Replace base DROUsageInfo.ToString function as necessary
|
// CSLATODO: Check DROUsageInfo.GetIdValue to assure that the ID returned is unique
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Overrides Base ToString
|
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>A string representation of current DROUsageInfo</returns>
|
/// <returns>A Unique ID for the current DROUsageInfo</returns>
|
||||||
//public override string ToString()
|
protected override object GetIdValue()
|
||||||
//{
|
{
|
||||||
// return base.ToString();
|
return MyDROUsageInfoUnique; // Absolutely Unique ID
|
||||||
//}
|
}
|
||||||
// CSLATODO: Check DROUsageInfo.GetIdValue to assure that the ID returned is unique
|
#endregion
|
||||||
/// <summary>
|
#region Factory Methods
|
||||||
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
private static int _DROUsageInfoUnique = 0;
|
||||||
/// </summary>
|
private static int DROUsageInfoUnique
|
||||||
/// <returns>A Unique ID for the current DROUsageInfo</returns>
|
{ get { return ++_DROUsageInfoUnique; } }
|
||||||
protected override object GetIdValue()
|
private int _MyDROUsageInfoUnique = DROUsageInfoUnique;
|
||||||
{
|
public int MyDROUsageInfoUnique // Absolutely Unique ID - Info
|
||||||
return MyDROUsageInfoUnique; // Absolutely Unique ID
|
{ get { return _MyDROUsageInfoUnique; } }
|
||||||
}
|
protected DROUsageInfo()
|
||||||
#endregion
|
{/* require use of factory methods */
|
||||||
#region Factory Methods
|
AddToCache(this);
|
||||||
private static int _DROUsageInfoUnique = 0;
|
}
|
||||||
private static int DROUsageInfoUnique
|
private bool _Disposed = false;
|
||||||
{ get { return ++_DROUsageInfoUnique; } }
|
private static int _CountCreated = 0;
|
||||||
private int _MyDROUsageInfoUnique = DROUsageInfoUnique;
|
private static int _CountDisposed = 0;
|
||||||
public int MyDROUsageInfoUnique // Absolutely Unique ID - Info
|
private static int _CountFinalized = 0;
|
||||||
{ get { return _MyDROUsageInfoUnique; } }
|
private static int IncrementCountCreated
|
||||||
protected DROUsageInfo()
|
{ get { return ++_CountCreated; } }
|
||||||
{/* require use of factory methods */
|
private int _CountWhenCreated = IncrementCountCreated;
|
||||||
AddToCache(this);
|
public static int CountCreated
|
||||||
}
|
{ get { return _CountCreated; } }
|
||||||
private bool _Disposed = false;
|
public static int CountNotDisposed
|
||||||
private static int _CountCreated = 0;
|
{ get { return _CountCreated - _CountDisposed; } }
|
||||||
private static int _CountDisposed = 0;
|
public static int CountNotFinalized
|
||||||
private static int _CountFinalized = 0;
|
{ get { return _CountCreated - _CountFinalized; } }
|
||||||
private static int IncrementCountCreated
|
~DROUsageInfo()
|
||||||
{ get { return ++_CountCreated; } }
|
{
|
||||||
private int _CountWhenCreated = IncrementCountCreated;
|
_CountFinalized++;
|
||||||
public static int CountCreated
|
}
|
||||||
{ get { return _CountCreated; } }
|
public void Dispose()
|
||||||
public static int CountNotDisposed
|
{
|
||||||
{ get { return _CountCreated - _CountDisposed; } }
|
if (_Disposed) return;
|
||||||
public static int CountNotFinalized
|
_CountDisposed++;
|
||||||
{ get { return _CountCreated - _CountFinalized; } }
|
_Disposed = true;
|
||||||
~DROUsageInfo()
|
RemoveFromCache(this);
|
||||||
{
|
if (!_CacheByPrimaryKey.ContainsKey(DROUsageID.ToString())) return;
|
||||||
_CountFinalized++;
|
List<DROUsageInfo> listDROUsageInfo = _CacheByPrimaryKey[DROUsageID.ToString()]; // Get the list of items
|
||||||
}
|
while (listDROUsageInfo.Contains(this)) listDROUsageInfo.Remove(this); // Remove the item from the list
|
||||||
public void Dispose()
|
if (listDROUsageInfo.Count == 0) // If there are no items left in the list
|
||||||
{
|
_CacheByPrimaryKey.Remove(DROUsageID.ToString()); // remove the list
|
||||||
if (_Disposed) return;
|
}
|
||||||
_CountDisposed++;
|
public virtual DROUsage Get()
|
||||||
_Disposed = true;
|
{
|
||||||
RemoveFromCache(this);
|
return _Editable = DROUsage.Get(_DROUsageID);
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(DROUsageID.ToString())) return;
|
}
|
||||||
List<DROUsageInfo> listDROUsageInfo = _CacheByPrimaryKey[DROUsageID.ToString()]; // Get the list of items
|
public static void Refresh(DROUsage tmp)
|
||||||
while (listDROUsageInfo.Contains(this)) listDROUsageInfo.Remove(this); // Remove the item from the list
|
{
|
||||||
if (listDROUsageInfo.Count == 0) // If there are no items left in the list
|
string key = tmp.DROUsageID.ToString();
|
||||||
_CacheByPrimaryKey.Remove(DROUsageID.ToString()); // remove the list
|
ConvertListToDictionary();
|
||||||
}
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
public virtual DROUsage Get()
|
foreach (DROUsageInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
{
|
tmpInfo.RefreshFields(tmp);
|
||||||
return _Editable = DROUsage.Get(_DROUsageID);
|
}
|
||||||
}
|
protected virtual void RefreshFields(DROUsage tmp)
|
||||||
public static void Refresh(DROUsage tmp)
|
{
|
||||||
{
|
if (_DocID != tmp.DocID)
|
||||||
string key = tmp.DROUsageID.ToString();
|
{
|
||||||
ConvertListToDictionary();
|
if (MyDocument != null) MyDocument.RefreshDocumentDROUsages(); // Update List for old value
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
_DocID = tmp.DocID; // Update the value
|
||||||
foreach (DROUsageInfo tmpInfo in _CacheByPrimaryKey[key])
|
}
|
||||||
tmpInfo.RefreshFields(tmp);
|
_MyDocument = null; // Reset list so that the next line gets a new list
|
||||||
}
|
if (MyDocument != null) MyDocument.RefreshDocumentDROUsages(); // Update List for new value
|
||||||
protected virtual void RefreshFields(DROUsage tmp)
|
_ROID = tmp.ROID;
|
||||||
{
|
_Config = tmp.Config;
|
||||||
if (_DocID != tmp.DocID)
|
_DTS = tmp.DTS;
|
||||||
{
|
_UserID = tmp.UserID;
|
||||||
if (MyDocument != null) MyDocument.RefreshDocumentDROUsages(); // Update List for old value
|
if (_RODbID != tmp.RODbID)
|
||||||
_DocID = tmp.DocID; // Update the value
|
{
|
||||||
}
|
if (MyRODb != null) MyRODb.RefreshRODbDROUsages(); // Update List for old value
|
||||||
_MyDocument = null; // Reset list so that the next line gets a new list
|
_RODbID = tmp.RODbID; // Update the value
|
||||||
if (MyDocument != null) MyDocument.RefreshDocumentDROUsages(); // Update List for new value
|
}
|
||||||
_ROID = tmp.ROID;
|
_MyRODb = null; // Reset list so that the next line gets a new list
|
||||||
_Config = tmp.Config;
|
if (MyRODb != null) MyRODb.RefreshRODbDROUsages(); // Update List for new value
|
||||||
_DTS = tmp.DTS;
|
_DROUsageInfoExtension.Refresh(this);
|
||||||
_UserID = tmp.UserID;
|
OnChange();// raise an event
|
||||||
if (_RODbID != tmp.RODbID)
|
}
|
||||||
{
|
public static void Refresh(DocumentDROUsage tmp)
|
||||||
if (MyRODb != null) MyRODb.RefreshRODbDROUsages(); // Update List for old value
|
{
|
||||||
_RODbID = tmp.RODbID; // Update the value
|
string key = tmp.DROUsageID.ToString();
|
||||||
}
|
ConvertListToDictionary();
|
||||||
_MyRODb = null; // Reset list so that the next line gets a new list
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
if (MyRODb != null) MyRODb.RefreshRODbDROUsages(); // Update List for new value
|
foreach (DROUsageInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
_DROUsageInfoExtension.Refresh(this);
|
tmpInfo.RefreshFields(tmp);
|
||||||
OnChange();// raise an event
|
}
|
||||||
}
|
protected virtual void RefreshFields(DocumentDROUsage tmp)
|
||||||
public static void Refresh(DocumentDROUsage tmp)
|
{
|
||||||
{
|
_ROID = tmp.ROID;
|
||||||
string key = tmp.DROUsageID.ToString();
|
_Config = tmp.Config;
|
||||||
ConvertListToDictionary();
|
_DTS = tmp.DTS;
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
_UserID = tmp.UserID;
|
||||||
foreach (DROUsageInfo tmpInfo in _CacheByPrimaryKey[key])
|
if (_RODbID != tmp.RODbID)
|
||||||
tmpInfo.RefreshFields(tmp);
|
{
|
||||||
}
|
if (MyRODb != null) MyRODb.RefreshRODbDROUsages(); // Update List for old value
|
||||||
protected virtual void RefreshFields(DocumentDROUsage tmp)
|
_RODbID = tmp.RODbID; // Update the value
|
||||||
{
|
}
|
||||||
_ROID = tmp.ROID;
|
_MyRODb = null; // Reset list so that the next line gets a new list
|
||||||
_Config = tmp.Config;
|
if (MyRODb != null) MyRODb.RefreshRODbDROUsages(); // Update List for new value
|
||||||
_DTS = tmp.DTS;
|
_DROUsageInfoExtension.Refresh(this);
|
||||||
_UserID = tmp.UserID;
|
OnChange();// raise an event
|
||||||
if (_RODbID != tmp.RODbID)
|
}
|
||||||
{
|
public static void Refresh(RODbDROUsage tmp)
|
||||||
if (MyRODb != null) MyRODb.RefreshRODbDROUsages(); // Update List for old value
|
{
|
||||||
_RODbID = tmp.RODbID; // Update the value
|
string key = tmp.DROUsageID.ToString();
|
||||||
}
|
ConvertListToDictionary();
|
||||||
_MyRODb = null; // Reset list so that the next line gets a new list
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
if (MyRODb != null) MyRODb.RefreshRODbDROUsages(); // Update List for new value
|
foreach (DROUsageInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
_DROUsageInfoExtension.Refresh(this);
|
tmpInfo.RefreshFields(tmp);
|
||||||
OnChange();// raise an event
|
}
|
||||||
}
|
protected virtual void RefreshFields(RODbDROUsage tmp)
|
||||||
public static void Refresh(RODbDROUsage tmp)
|
{
|
||||||
{
|
if (_DocID != tmp.DocID)
|
||||||
string key = tmp.DROUsageID.ToString();
|
{
|
||||||
ConvertListToDictionary();
|
if (MyDocument != null) MyDocument.RefreshDocumentDROUsages(); // Update List for old value
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
_DocID = tmp.DocID; // Update the value
|
||||||
foreach (DROUsageInfo tmpInfo in _CacheByPrimaryKey[key])
|
}
|
||||||
tmpInfo.RefreshFields(tmp);
|
_MyDocument = null; // Reset list so that the next line gets a new list
|
||||||
}
|
if (MyDocument != null) MyDocument.RefreshDocumentDROUsages(); // Update List for new value
|
||||||
protected virtual void RefreshFields(RODbDROUsage tmp)
|
_ROID = tmp.ROID;
|
||||||
{
|
_Config = tmp.Config;
|
||||||
if (_DocID != tmp.DocID)
|
_DTS = tmp.DTS;
|
||||||
{
|
_UserID = tmp.UserID;
|
||||||
if (MyDocument != null) MyDocument.RefreshDocumentDROUsages(); // Update List for old value
|
_DROUsageInfoExtension.Refresh(this);
|
||||||
_DocID = tmp.DocID; // Update the value
|
OnChange();// raise an event
|
||||||
}
|
}
|
||||||
_MyDocument = null; // Reset list so that the next line gets a new list
|
public static DROUsageInfo Get(int dROUsageID)
|
||||||
if (MyDocument != null) MyDocument.RefreshDocumentDROUsages(); // Update List for new value
|
{
|
||||||
_ROID = tmp.ROID;
|
//if (!CanGetObject())
|
||||||
_Config = tmp.Config;
|
// throw new System.Security.SecurityException("User not authorized to view a DROUsage");
|
||||||
_DTS = tmp.DTS;
|
try
|
||||||
_UserID = tmp.UserID;
|
{
|
||||||
_DROUsageInfoExtension.Refresh(this);
|
DROUsageInfo tmp = GetCachedByPrimaryKey(dROUsageID);
|
||||||
OnChange();// raise an event
|
if (tmp == null)
|
||||||
}
|
{
|
||||||
public static DROUsageInfo Get(int dROUsageID)
|
tmp = DataPortal.Fetch<DROUsageInfo>(new PKCriteria(dROUsageID));
|
||||||
{
|
AddToCache(tmp);
|
||||||
//if (!CanGetObject())
|
}
|
||||||
// throw new System.Security.SecurityException("User not authorized to view a DROUsage");
|
if (tmp.ErrorMessage == "No Record Found")
|
||||||
try
|
{
|
||||||
{
|
tmp.Dispose(); // Clean-up DROUsageInfo
|
||||||
DROUsageInfo tmp = GetCachedByPrimaryKey(dROUsageID);
|
tmp = null;
|
||||||
if (tmp == null)
|
}
|
||||||
{
|
return tmp;
|
||||||
tmp = DataPortal.Fetch<DROUsageInfo>(new PKCriteria(dROUsageID));
|
}
|
||||||
AddToCache(tmp);
|
catch (Exception ex)
|
||||||
}
|
{
|
||||||
if (tmp.ErrorMessage == "No Record Found")
|
throw new DbCslaException("Error on DROUsageInfo.Get", ex);
|
||||||
{
|
}
|
||||||
tmp.Dispose(); // Clean-up DROUsageInfo
|
}
|
||||||
tmp = null;
|
#endregion
|
||||||
}
|
#region Data Access Portal
|
||||||
return tmp;
|
internal DROUsageInfo(SafeDataReader dr)
|
||||||
}
|
{
|
||||||
catch (Exception ex)
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DROUsageInfo.Constructor", GetHashCode());
|
||||||
{
|
try
|
||||||
throw new DbCslaException("Error on DROUsageInfo.Get", ex);
|
{
|
||||||
}
|
ReadData(dr);
|
||||||
}
|
}
|
||||||
#endregion
|
catch (Exception ex)
|
||||||
#region Data Access Portal
|
{
|
||||||
internal DROUsageInfo(SafeDataReader dr)
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("DROUsageInfo.Constructor", ex);
|
||||||
{
|
throw new DbCslaException("DROUsageInfo.Constructor", ex);
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DROUsageInfo.Constructor", GetHashCode());
|
}
|
||||||
try
|
}
|
||||||
{
|
[Serializable()]
|
||||||
ReadData(dr);
|
protected class PKCriteria
|
||||||
}
|
{
|
||||||
catch (Exception ex)
|
private int _DROUsageID;
|
||||||
{
|
public int DROUsageID
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DROUsageInfo.Constructor", ex);
|
{ get { return _DROUsageID; } }
|
||||||
throw new DbCslaException("DROUsageInfo.Constructor", ex);
|
public PKCriteria(int dROUsageID)
|
||||||
}
|
{
|
||||||
}
|
_DROUsageID = dROUsageID;
|
||||||
[Serializable()]
|
}
|
||||||
protected class PKCriteria
|
}
|
||||||
{
|
private void ReadData(SafeDataReader dr)
|
||||||
private int _DROUsageID;
|
{
|
||||||
public int DROUsageID
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DROUsageInfo.ReadData", GetHashCode());
|
||||||
{ get { return _DROUsageID; } }
|
try
|
||||||
public PKCriteria(int dROUsageID)
|
{
|
||||||
{
|
_DROUsageID = dr.GetInt32("DROUsageID");
|
||||||
_DROUsageID = dROUsageID;
|
_DocID = dr.GetInt32("DocID");
|
||||||
}
|
_ROID = dr.GetString("ROID");
|
||||||
}
|
_Config = dr.GetString("Config");
|
||||||
private void ReadData(SafeDataReader dr)
|
_DTS = dr.GetDateTime("DTS");
|
||||||
{
|
_UserID = dr.GetString("UserID");
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DROUsageInfo.ReadData", GetHashCode());
|
_RODbID = dr.GetInt32("RODbID");
|
||||||
try
|
}
|
||||||
{
|
catch (Exception ex)
|
||||||
_DROUsageID = dr.GetInt32("DROUsageID");
|
{
|
||||||
_DocID = dr.GetInt32("DocID");
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("DROUsageInfo.ReadData", ex);
|
||||||
_ROID = dr.GetString("ROID");
|
_ErrorMessage = ex.Message;
|
||||||
_Config = dr.GetString("Config");
|
throw new DbCslaException("DROUsageInfo.ReadData", ex);
|
||||||
_DTS = dr.GetDateTime("DTS");
|
}
|
||||||
_UserID = dr.GetString("UserID");
|
}
|
||||||
_RODbID = dr.GetInt32("RODbID");
|
private void DataPortal_Fetch(PKCriteria criteria)
|
||||||
}
|
{
|
||||||
catch (Exception ex)
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DROUsageInfo.DataPortal_Fetch", GetHashCode());
|
||||||
{
|
try
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DROUsageInfo.ReadData", ex);
|
{
|
||||||
_ErrorMessage = ex.Message;
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
throw new DbCslaException("DROUsageInfo.ReadData", ex);
|
{
|
||||||
}
|
ApplicationContext.LocalContext["cn"] = cn;
|
||||||
}
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
private void DataPortal_Fetch(PKCriteria criteria)
|
{
|
||||||
{
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DROUsageInfo.DataPortal_Fetch", GetHashCode());
|
cm.CommandText = "getDROUsage";
|
||||||
try
|
cm.Parameters.AddWithValue("@DROUsageID", criteria.DROUsageID);
|
||||||
{
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
{
|
{
|
||||||
ApplicationContext.LocalContext["cn"] = cn;
|
if (!dr.Read())
|
||||||
using (SqlCommand cm = cn.CreateCommand())
|
{
|
||||||
{
|
_ErrorMessage = "No Record Found";
|
||||||
cm.CommandType = CommandType.StoredProcedure;
|
return;
|
||||||
cm.CommandText = "getDROUsage";
|
}
|
||||||
cm.Parameters.AddWithValue("@DROUsageID", criteria.DROUsageID);
|
ReadData(dr);
|
||||||
cm.CommandTimeout = Database.DefaultTimeout;
|
}
|
||||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
}
|
||||||
{
|
// removing of item only needed for local data portal
|
||||||
if (!dr.Read())
|
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
||||||
{
|
ApplicationContext.LocalContext.Remove("cn");
|
||||||
_ErrorMessage = "No Record Found";
|
}
|
||||||
return;
|
}
|
||||||
}
|
catch (Exception ex)
|
||||||
ReadData(dr);
|
{
|
||||||
}
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("DROUsageInfo.DataPortal_Fetch", ex);
|
||||||
}
|
_ErrorMessage = ex.Message;
|
||||||
// removing of item only needed for local data portal
|
throw new DbCslaException("DROUsageInfo.DataPortal_Fetch", ex);
|
||||||
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
}
|
||||||
ApplicationContext.LocalContext.Remove("cn");
|
}
|
||||||
}
|
#endregion
|
||||||
}
|
// Standard Refresh
|
||||||
catch (Exception ex)
|
#region extension
|
||||||
{
|
DROUsageInfoExtension _DROUsageInfoExtension = new DROUsageInfoExtension();
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DROUsageInfo.DataPortal_Fetch", ex);
|
[Serializable()]
|
||||||
_ErrorMessage = ex.Message;
|
partial class DROUsageInfoExtension : extensionBase { }
|
||||||
throw new DbCslaException("DROUsageInfo.DataPortal_Fetch", ex);
|
[Serializable()]
|
||||||
}
|
class extensionBase
|
||||||
}
|
{
|
||||||
#endregion
|
// Default Refresh
|
||||||
// Standard Refresh
|
public virtual void Refresh(DROUsageInfo tmp) { }
|
||||||
#region extension
|
}
|
||||||
DROUsageInfoExtension _DROUsageInfoExtension = new DROUsageInfoExtension();
|
#endregion
|
||||||
[Serializable()]
|
} // Class
|
||||||
partial class DROUsageInfoExtension : extensionBase { }
|
#region Converter
|
||||||
[Serializable()]
|
internal class DROUsageInfoConverter : ExpandableObjectConverter
|
||||||
class extensionBase
|
{
|
||||||
{
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
// Default Refresh
|
{
|
||||||
public virtual void Refresh(DROUsageInfo tmp) { }
|
if (destType == typeof(string) && value is DROUsageInfo)
|
||||||
}
|
{
|
||||||
#endregion
|
// Return the ToString value
|
||||||
} // Class
|
return ((DROUsageInfo)value).ToString();
|
||||||
#region Converter
|
}
|
||||||
internal class DROUsageInfoConverter : ExpandableObjectConverter
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
{
|
}
|
||||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
}
|
||||||
{
|
#endregion
|
||||||
if (destType == typeof(string) && value is DROUsageInfo)
|
|
||||||
{
|
|
||||||
// Return the ToString value
|
|
||||||
return ((DROUsageInfo)value).ToString();
|
|
||||||
}
|
|
||||||
return base.ConvertTo(context, culture, value, destType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -19,397 +19,389 @@ using System.ComponentModel;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
public delegate void DetailInfoEvent(object sender);
|
public delegate void DetailInfoEvent(object sender);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// DetailInfo Generated by MyGeneration using the CSLA Object Mapping template
|
/// DetailInfo Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
[TypeConverter(typeof(DetailInfoConverter))]
|
[TypeConverter(typeof(DetailInfoConverter))]
|
||||||
public partial class DetailInfo : ReadOnlyBase<DetailInfo>, IDisposable
|
public partial class DetailInfo : ReadOnlyBase<DetailInfo>, IDisposable
|
||||||
{
|
{
|
||||||
public event DetailInfoEvent Changed;
|
public event DetailInfoEvent Changed;
|
||||||
private void OnChange()
|
private void OnChange()
|
||||||
{
|
{
|
||||||
if (Changed != null) Changed(this);
|
if (Changed != null) Changed(this);
|
||||||
}
|
}
|
||||||
#region Log4Net
|
#region Log4Net
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
private static List<DetailInfo> _CacheList = new List<DetailInfo>();
|
private static List<DetailInfo> _CacheList = new List<DetailInfo>();
|
||||||
protected static void AddToCache(DetailInfo detailInfo)
|
protected static void AddToCache(DetailInfo detailInfo)
|
||||||
{
|
{
|
||||||
if (!_CacheList.Contains(detailInfo)) _CacheList.Add(detailInfo); // In AddToCache
|
if (!_CacheList.Contains(detailInfo)) _CacheList.Add(detailInfo); // In AddToCache
|
||||||
}
|
}
|
||||||
protected static void RemoveFromCache(DetailInfo detailInfo)
|
protected static void RemoveFromCache(DetailInfo detailInfo)
|
||||||
{
|
{
|
||||||
while (_CacheList.Contains(detailInfo)) _CacheList.Remove(detailInfo); // In RemoveFromCache
|
while (_CacheList.Contains(detailInfo)) _CacheList.Remove(detailInfo); // In RemoveFromCache
|
||||||
}
|
}
|
||||||
private static Dictionary<string, List<DetailInfo>> _CacheByPrimaryKey = new Dictionary<string, List<DetailInfo>>();
|
private static Dictionary<string, List<DetailInfo>> _CacheByPrimaryKey = new Dictionary<string, List<DetailInfo>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
while (_CacheList.Count > 0) // Move DetailInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
while (_CacheList.Count > 0) // Move DetailInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
||||||
{
|
{
|
||||||
DetailInfo tmp = _CacheList[0]; // Get the first DetailInfo
|
DetailInfo tmp = _CacheList[0]; // Get the first DetailInfo
|
||||||
string pKey = tmp.DetailID.ToString();
|
string pKey = tmp.DetailID.ToString();
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
||||||
{
|
{
|
||||||
_CacheByPrimaryKey[pKey] = new List<DetailInfo>(); // Add new list for PrimaryKey
|
_CacheByPrimaryKey[pKey] = new List<DetailInfo>(); // Add new list for PrimaryKey
|
||||||
}
|
}
|
||||||
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
||||||
_CacheList.RemoveAt(0); // Remove the first DetailInfo
|
_CacheList.RemoveAt(0); // Remove the first DetailInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
internal static void AddList(DetailInfoList lst)
|
internal static void AddList(DetailInfoList lst)
|
||||||
{
|
{
|
||||||
foreach (DetailInfo item in lst) AddToCache(item);
|
foreach (DetailInfo item in lst) AddToCache(item);
|
||||||
}
|
}
|
||||||
protected static DetailInfo GetCachedByPrimaryKey(int detailID)
|
protected static DetailInfo GetCachedByPrimaryKey(int detailID)
|
||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = detailID.ToString();
|
string key = detailID.ToString();
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Business Methods
|
#region Business Methods
|
||||||
private string _ErrorMessage = string.Empty;
|
private string _ErrorMessage = string.Empty;
|
||||||
public string ErrorMessage
|
public string ErrorMessage
|
||||||
{
|
{
|
||||||
get { return _ErrorMessage; }
|
get { return _ErrorMessage; }
|
||||||
}
|
}
|
||||||
protected Detail _Editable;
|
protected Detail _Editable;
|
||||||
private IVEHasBrokenRules HasBrokenRules
|
private IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
IVEHasBrokenRules hasBrokenRules = null;
|
IVEHasBrokenRules hasBrokenRules = null;
|
||||||
if (_Editable != null)
|
if (_Editable != null)
|
||||||
hasBrokenRules = _Editable.HasBrokenRules;
|
hasBrokenRules = _Editable.HasBrokenRules;
|
||||||
return hasBrokenRules;
|
return hasBrokenRules;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private int _DetailID;
|
private int _DetailID;
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
public int DetailID
|
public int DetailID
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("DetailID", true);
|
return _DetailID;
|
||||||
return _DetailID;
|
}
|
||||||
}
|
}
|
||||||
}
|
private int _ContentID;
|
||||||
private int _ContentID;
|
public int ContentID
|
||||||
public int ContentID
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
get
|
||||||
get
|
{
|
||||||
{
|
if (_MyContent != null) _ContentID = _MyContent.ContentID;
|
||||||
CanReadProperty("ContentID", true);
|
return _ContentID;
|
||||||
if (_MyContent != null) _ContentID = _MyContent.ContentID;
|
}
|
||||||
return _ContentID;
|
}
|
||||||
}
|
private ContentInfo _MyContent;
|
||||||
}
|
public ContentInfo MyContent
|
||||||
private ContentInfo _MyContent;
|
{
|
||||||
public ContentInfo MyContent
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
if (_MyContent == null && _ContentID != 0) _MyContent = ContentInfo.Get(_ContentID);
|
||||||
{
|
return _MyContent;
|
||||||
CanReadProperty("MyContent", true);
|
}
|
||||||
if (_MyContent == null && _ContentID != 0) _MyContent = ContentInfo.Get(_ContentID);
|
}
|
||||||
return _MyContent;
|
private int _ItemType;
|
||||||
}
|
public int ItemType
|
||||||
}
|
{
|
||||||
private int _ItemType;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
public int ItemType
|
get
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
return _ItemType;
|
||||||
get
|
}
|
||||||
{
|
}
|
||||||
CanReadProperty("ItemType", true);
|
private string _Text = string.Empty;
|
||||||
return _ItemType;
|
public string Text
|
||||||
}
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
private string _Text = string.Empty;
|
get
|
||||||
public string Text
|
{
|
||||||
{
|
return _Text;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
}
|
||||||
{
|
private string _Config = string.Empty;
|
||||||
CanReadProperty("Text", true);
|
public string Config
|
||||||
return _Text;
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
private string _Config = string.Empty;
|
{
|
||||||
public string Config
|
return _Config;
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
private DateTime _DTS = new DateTime();
|
||||||
{
|
public DateTime DTS
|
||||||
CanReadProperty("Config", true);
|
{
|
||||||
return _Config;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
}
|
{
|
||||||
private DateTime _DTS = new DateTime();
|
return _DTS;
|
||||||
public DateTime DTS
|
}
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
private string _UserID = string.Empty;
|
||||||
get
|
public string UserID
|
||||||
{
|
{
|
||||||
CanReadProperty("DTS", true);
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
return _DTS;
|
get
|
||||||
}
|
{
|
||||||
}
|
return _UserID;
|
||||||
private string _UserID = string.Empty;
|
}
|
||||||
public string UserID
|
}
|
||||||
{
|
// CSLATODO: Replace base DetailInfo.ToString function as necessary
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
/// <summary>
|
||||||
get
|
/// Overrides Base ToString
|
||||||
{
|
/// </summary>
|
||||||
CanReadProperty("UserID", true);
|
/// <returns>A string representation of current DetailInfo</returns>
|
||||||
return _UserID;
|
//public override string ToString()
|
||||||
}
|
//{
|
||||||
}
|
// return base.ToString();
|
||||||
// CSLATODO: Replace base DetailInfo.ToString function as necessary
|
//}
|
||||||
/// <summary>
|
// CSLATODO: Check DetailInfo.GetIdValue to assure that the ID returned is unique
|
||||||
/// Overrides Base ToString
|
/// <summary>
|
||||||
/// </summary>
|
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||||
/// <returns>A string representation of current DetailInfo</returns>
|
/// </summary>
|
||||||
//public override string ToString()
|
/// <returns>A Unique ID for the current DetailInfo</returns>
|
||||||
//{
|
protected override object GetIdValue()
|
||||||
// return base.ToString();
|
{
|
||||||
//}
|
return MyDetailInfoUnique; // Absolutely Unique ID
|
||||||
// CSLATODO: Check DetailInfo.GetIdValue to assure that the ID returned is unique
|
}
|
||||||
/// <summary>
|
#endregion
|
||||||
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
#region Factory Methods
|
||||||
/// </summary>
|
private static int _DetailInfoUnique = 0;
|
||||||
/// <returns>A Unique ID for the current DetailInfo</returns>
|
private static int DetailInfoUnique
|
||||||
protected override object GetIdValue()
|
{ get { return ++_DetailInfoUnique; } }
|
||||||
{
|
private int _MyDetailInfoUnique = DetailInfoUnique;
|
||||||
return MyDetailInfoUnique; // Absolutely Unique ID
|
public int MyDetailInfoUnique // Absolutely Unique ID - Info
|
||||||
}
|
{ get { return _MyDetailInfoUnique; } }
|
||||||
#endregion
|
protected DetailInfo()
|
||||||
#region Factory Methods
|
{/* require use of factory methods */
|
||||||
private static int _DetailInfoUnique = 0;
|
AddToCache(this);
|
||||||
private static int DetailInfoUnique
|
}
|
||||||
{ get { return ++_DetailInfoUnique; } }
|
private bool _Disposed = false;
|
||||||
private int _MyDetailInfoUnique = DetailInfoUnique;
|
private static int _CountCreated = 0;
|
||||||
public int MyDetailInfoUnique // Absolutely Unique ID - Info
|
private static int _CountDisposed = 0;
|
||||||
{ get { return _MyDetailInfoUnique; } }
|
private static int _CountFinalized = 0;
|
||||||
protected DetailInfo()
|
private static int IncrementCountCreated
|
||||||
{/* require use of factory methods */
|
{ get { return ++_CountCreated; } }
|
||||||
AddToCache(this);
|
private int _CountWhenCreated = IncrementCountCreated;
|
||||||
}
|
public static int CountCreated
|
||||||
private bool _Disposed = false;
|
{ get { return _CountCreated; } }
|
||||||
private static int _CountCreated = 0;
|
public static int CountNotDisposed
|
||||||
private static int _CountDisposed = 0;
|
{ get { return _CountCreated - _CountDisposed; } }
|
||||||
private static int _CountFinalized = 0;
|
public static int CountNotFinalized
|
||||||
private static int IncrementCountCreated
|
{ get { return _CountCreated - _CountFinalized; } }
|
||||||
{ get { return ++_CountCreated; } }
|
~DetailInfo()
|
||||||
private int _CountWhenCreated = IncrementCountCreated;
|
{
|
||||||
public static int CountCreated
|
_CountFinalized++;
|
||||||
{ get { return _CountCreated; } }
|
}
|
||||||
public static int CountNotDisposed
|
public void Dispose()
|
||||||
{ get { return _CountCreated - _CountDisposed; } }
|
{
|
||||||
public static int CountNotFinalized
|
if (_Disposed) return;
|
||||||
{ get { return _CountCreated - _CountFinalized; } }
|
_CountDisposed++;
|
||||||
~DetailInfo()
|
_Disposed = true;
|
||||||
{
|
RemoveFromCache(this);
|
||||||
_CountFinalized++;
|
if (!_CacheByPrimaryKey.ContainsKey(DetailID.ToString())) return;
|
||||||
}
|
List<DetailInfo> listDetailInfo = _CacheByPrimaryKey[DetailID.ToString()]; // Get the list of items
|
||||||
public void Dispose()
|
while (listDetailInfo.Contains(this)) listDetailInfo.Remove(this); // Remove the item from the list
|
||||||
{
|
if (listDetailInfo.Count == 0) // If there are no items left in the list
|
||||||
if (_Disposed) return;
|
_CacheByPrimaryKey.Remove(DetailID.ToString()); // remove the list
|
||||||
_CountDisposed++;
|
}
|
||||||
_Disposed = true;
|
public virtual Detail Get()
|
||||||
RemoveFromCache(this);
|
{
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(DetailID.ToString())) return;
|
return _Editable = Detail.Get(_DetailID);
|
||||||
List<DetailInfo> listDetailInfo = _CacheByPrimaryKey[DetailID.ToString()]; // Get the list of items
|
}
|
||||||
while (listDetailInfo.Contains(this)) listDetailInfo.Remove(this); // Remove the item from the list
|
public static void Refresh(Detail tmp)
|
||||||
if (listDetailInfo.Count == 0) // If there are no items left in the list
|
{
|
||||||
_CacheByPrimaryKey.Remove(DetailID.ToString()); // remove the list
|
string key = tmp.DetailID.ToString();
|
||||||
}
|
ConvertListToDictionary();
|
||||||
public virtual Detail Get()
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
{
|
foreach (DetailInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
return _Editable = Detail.Get(_DetailID);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
public static void Refresh(Detail tmp)
|
protected virtual void RefreshFields(Detail tmp)
|
||||||
{
|
{
|
||||||
string key = tmp.DetailID.ToString();
|
if (_ContentID != tmp.ContentID)
|
||||||
ConvertListToDictionary();
|
{
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
if (MyContent != null) MyContent.RefreshContentDetails(); // Update List for old value
|
||||||
foreach (DetailInfo tmpInfo in _CacheByPrimaryKey[key])
|
_ContentID = tmp.ContentID; // Update the value
|
||||||
tmpInfo.RefreshFields(tmp);
|
}
|
||||||
}
|
_MyContent = null; // Reset list so that the next line gets a new list
|
||||||
protected virtual void RefreshFields(Detail tmp)
|
if (MyContent != null) MyContent.RefreshContentDetails(); // Update List for new value
|
||||||
{
|
_ItemType = tmp.ItemType;
|
||||||
if (_ContentID != tmp.ContentID)
|
_Text = tmp.Text;
|
||||||
{
|
_Config = tmp.Config;
|
||||||
if (MyContent != null) MyContent.RefreshContentDetails(); // Update List for old value
|
_DTS = tmp.DTS;
|
||||||
_ContentID = tmp.ContentID; // Update the value
|
_UserID = tmp.UserID;
|
||||||
}
|
_DetailInfoExtension.Refresh(this);
|
||||||
_MyContent = null; // Reset list so that the next line gets a new list
|
OnChange();// raise an event
|
||||||
if (MyContent != null) MyContent.RefreshContentDetails(); // Update List for new value
|
}
|
||||||
_ItemType = tmp.ItemType;
|
public static void Refresh(ContentDetail tmp)
|
||||||
_Text = tmp.Text;
|
{
|
||||||
_Config = tmp.Config;
|
string key = tmp.DetailID.ToString();
|
||||||
_DTS = tmp.DTS;
|
ConvertListToDictionary();
|
||||||
_UserID = tmp.UserID;
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
_DetailInfoExtension.Refresh(this);
|
foreach (DetailInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
OnChange();// raise an event
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
public static void Refresh(ContentDetail tmp)
|
protected virtual void RefreshFields(ContentDetail tmp)
|
||||||
{
|
{
|
||||||
string key = tmp.DetailID.ToString();
|
_ItemType = tmp.ItemType;
|
||||||
ConvertListToDictionary();
|
_Text = tmp.Text;
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
_Config = tmp.Config;
|
||||||
foreach (DetailInfo tmpInfo in _CacheByPrimaryKey[key])
|
_DTS = tmp.DTS;
|
||||||
tmpInfo.RefreshFields(tmp);
|
_UserID = tmp.UserID;
|
||||||
}
|
_DetailInfoExtension.Refresh(this);
|
||||||
protected virtual void RefreshFields(ContentDetail tmp)
|
OnChange();// raise an event
|
||||||
{
|
}
|
||||||
_ItemType = tmp.ItemType;
|
public static DetailInfo Get(int detailID)
|
||||||
_Text = tmp.Text;
|
{
|
||||||
_Config = tmp.Config;
|
//if (!CanGetObject())
|
||||||
_DTS = tmp.DTS;
|
// throw new System.Security.SecurityException("User not authorized to view a Detail");
|
||||||
_UserID = tmp.UserID;
|
try
|
||||||
_DetailInfoExtension.Refresh(this);
|
{
|
||||||
OnChange();// raise an event
|
DetailInfo tmp = GetCachedByPrimaryKey(detailID);
|
||||||
}
|
if (tmp == null)
|
||||||
public static DetailInfo Get(int detailID)
|
{
|
||||||
{
|
tmp = DataPortal.Fetch<DetailInfo>(new PKCriteria(detailID));
|
||||||
//if (!CanGetObject())
|
AddToCache(tmp);
|
||||||
// throw new System.Security.SecurityException("User not authorized to view a Detail");
|
}
|
||||||
try
|
if (tmp.ErrorMessage == "No Record Found")
|
||||||
{
|
{
|
||||||
DetailInfo tmp = GetCachedByPrimaryKey(detailID);
|
tmp.Dispose(); // Clean-up DetailInfo
|
||||||
if (tmp == null)
|
tmp = null;
|
||||||
{
|
}
|
||||||
tmp = DataPortal.Fetch<DetailInfo>(new PKCriteria(detailID));
|
return tmp;
|
||||||
AddToCache(tmp);
|
}
|
||||||
}
|
catch (Exception ex)
|
||||||
if (tmp.ErrorMessage == "No Record Found")
|
{
|
||||||
{
|
throw new DbCslaException("Error on DetailInfo.Get", ex);
|
||||||
tmp.Dispose(); // Clean-up DetailInfo
|
}
|
||||||
tmp = null;
|
}
|
||||||
}
|
#endregion
|
||||||
return tmp;
|
#region Data Access Portal
|
||||||
}
|
internal DetailInfo(SafeDataReader dr)
|
||||||
catch (Exception ex)
|
{
|
||||||
{
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DetailInfo.Constructor", GetHashCode());
|
||||||
throw new DbCslaException("Error on DetailInfo.Get", ex);
|
try
|
||||||
}
|
{
|
||||||
}
|
ReadData(dr);
|
||||||
#endregion
|
}
|
||||||
#region Data Access Portal
|
catch (Exception ex)
|
||||||
internal DetailInfo(SafeDataReader dr)
|
{
|
||||||
{
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("DetailInfo.Constructor", ex);
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DetailInfo.Constructor", GetHashCode());
|
throw new DbCslaException("DetailInfo.Constructor", ex);
|
||||||
try
|
}
|
||||||
{
|
}
|
||||||
ReadData(dr);
|
[Serializable()]
|
||||||
}
|
protected class PKCriteria
|
||||||
catch (Exception ex)
|
{
|
||||||
{
|
private int _DetailID;
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DetailInfo.Constructor", ex);
|
public int DetailID
|
||||||
throw new DbCslaException("DetailInfo.Constructor", ex);
|
{ get { return _DetailID; } }
|
||||||
}
|
public PKCriteria(int detailID)
|
||||||
}
|
{
|
||||||
[Serializable()]
|
_DetailID = detailID;
|
||||||
protected class PKCriteria
|
}
|
||||||
{
|
}
|
||||||
private int _DetailID;
|
private void ReadData(SafeDataReader dr)
|
||||||
public int DetailID
|
{
|
||||||
{ get { return _DetailID; } }
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DetailInfo.ReadData", GetHashCode());
|
||||||
public PKCriteria(int detailID)
|
try
|
||||||
{
|
{
|
||||||
_DetailID = detailID;
|
_DetailID = dr.GetInt32("DetailID");
|
||||||
}
|
_ContentID = dr.GetInt32("ContentID");
|
||||||
}
|
_ItemType = dr.GetInt32("ItemType");
|
||||||
private void ReadData(SafeDataReader dr)
|
_Text = dr.GetString("Text");
|
||||||
{
|
_Config = dr.GetString("Config");
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DetailInfo.ReadData", GetHashCode());
|
_DTS = dr.GetDateTime("DTS");
|
||||||
try
|
_UserID = dr.GetString("UserID");
|
||||||
{
|
}
|
||||||
_DetailID = dr.GetInt32("DetailID");
|
catch (Exception ex)
|
||||||
_ContentID = dr.GetInt32("ContentID");
|
{
|
||||||
_ItemType = dr.GetInt32("ItemType");
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("DetailInfo.ReadData", ex);
|
||||||
_Text = dr.GetString("Text");
|
_ErrorMessage = ex.Message;
|
||||||
_Config = dr.GetString("Config");
|
throw new DbCslaException("DetailInfo.ReadData", ex);
|
||||||
_DTS = dr.GetDateTime("DTS");
|
}
|
||||||
_UserID = dr.GetString("UserID");
|
}
|
||||||
}
|
private void DataPortal_Fetch(PKCriteria criteria)
|
||||||
catch (Exception ex)
|
{
|
||||||
{
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DetailInfo.DataPortal_Fetch", GetHashCode());
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DetailInfo.ReadData", ex);
|
try
|
||||||
_ErrorMessage = ex.Message;
|
{
|
||||||
throw new DbCslaException("DetailInfo.ReadData", ex);
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
}
|
{
|
||||||
}
|
ApplicationContext.LocalContext["cn"] = cn;
|
||||||
private void DataPortal_Fetch(PKCriteria criteria)
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
{
|
{
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DetailInfo.DataPortal_Fetch", GetHashCode());
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
try
|
cm.CommandText = "getDetail";
|
||||||
{
|
cm.Parameters.AddWithValue("@DetailID", criteria.DetailID);
|
||||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
{
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
ApplicationContext.LocalContext["cn"] = cn;
|
{
|
||||||
using (SqlCommand cm = cn.CreateCommand())
|
if (!dr.Read())
|
||||||
{
|
{
|
||||||
cm.CommandType = CommandType.StoredProcedure;
|
_ErrorMessage = "No Record Found";
|
||||||
cm.CommandText = "getDetail";
|
return;
|
||||||
cm.Parameters.AddWithValue("@DetailID", criteria.DetailID);
|
}
|
||||||
cm.CommandTimeout = Database.DefaultTimeout;
|
ReadData(dr);
|
||||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
}
|
||||||
{
|
}
|
||||||
if (!dr.Read())
|
// removing of item only needed for local data portal
|
||||||
{
|
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
||||||
_ErrorMessage = "No Record Found";
|
ApplicationContext.LocalContext.Remove("cn");
|
||||||
return;
|
}
|
||||||
}
|
}
|
||||||
ReadData(dr);
|
catch (Exception ex)
|
||||||
}
|
{
|
||||||
}
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("DetailInfo.DataPortal_Fetch", ex);
|
||||||
// removing of item only needed for local data portal
|
_ErrorMessage = ex.Message;
|
||||||
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
throw new DbCslaException("DetailInfo.DataPortal_Fetch", ex);
|
||||||
ApplicationContext.LocalContext.Remove("cn");
|
}
|
||||||
}
|
}
|
||||||
}
|
#endregion
|
||||||
catch (Exception ex)
|
// Standard Refresh
|
||||||
{
|
#region extension
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DetailInfo.DataPortal_Fetch", ex);
|
DetailInfoExtension _DetailInfoExtension = new DetailInfoExtension();
|
||||||
_ErrorMessage = ex.Message;
|
[Serializable()]
|
||||||
throw new DbCslaException("DetailInfo.DataPortal_Fetch", ex);
|
partial class DetailInfoExtension : extensionBase { }
|
||||||
}
|
[Serializable()]
|
||||||
}
|
class extensionBase
|
||||||
#endregion
|
{
|
||||||
// Standard Refresh
|
// Default Refresh
|
||||||
#region extension
|
public virtual void Refresh(DetailInfo tmp) { }
|
||||||
DetailInfoExtension _DetailInfoExtension = new DetailInfoExtension();
|
}
|
||||||
[Serializable()]
|
#endregion
|
||||||
partial class DetailInfoExtension : extensionBase { }
|
} // Class
|
||||||
[Serializable()]
|
#region Converter
|
||||||
class extensionBase
|
internal class DetailInfoConverter : ExpandableObjectConverter
|
||||||
{
|
{
|
||||||
// Default Refresh
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
public virtual void Refresh(DetailInfo tmp) { }
|
{
|
||||||
}
|
if (destType == typeof(string) && value is DetailInfo)
|
||||||
#endregion
|
{
|
||||||
} // Class
|
// Return the ToString value
|
||||||
#region Converter
|
return ((DetailInfo)value).ToString();
|
||||||
internal class DetailInfoConverter : ExpandableObjectConverter
|
}
|
||||||
{
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
}
|
||||||
{
|
}
|
||||||
if (destType == typeof(string) && value is DetailInfo)
|
#endregion
|
||||||
{
|
|
||||||
// Return the ToString value
|
|
||||||
return ((DetailInfo)value).ToString();
|
|
||||||
}
|
|
||||||
return base.ConvertTo(context, culture, value, destType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -19,397 +19,387 @@ using System.ComponentModel;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
public delegate void DocumentAuditInfoEvent(object sender);
|
public delegate void DocumentAuditInfoEvent(object sender);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// DocumentAuditInfo Generated by MyGeneration using the CSLA Object Mapping template
|
/// DocumentAuditInfo Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
[TypeConverter(typeof(DocumentAuditInfoConverter))]
|
[TypeConverter(typeof(DocumentAuditInfoConverter))]
|
||||||
public partial class DocumentAuditInfo : ReadOnlyBase<DocumentAuditInfo>, IDisposable
|
public partial class DocumentAuditInfo : ReadOnlyBase<DocumentAuditInfo>, IDisposable
|
||||||
{
|
{
|
||||||
public event DocumentAuditInfoEvent Changed;
|
public event DocumentAuditInfoEvent Changed;
|
||||||
private void OnChange()
|
private void OnChange()
|
||||||
{
|
{
|
||||||
if (Changed != null) Changed(this);
|
if (Changed != null) Changed(this);
|
||||||
}
|
}
|
||||||
#region Log4Net
|
#region Log4Net
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
private static List<DocumentAuditInfo> _CacheList = new List<DocumentAuditInfo>();
|
private static List<DocumentAuditInfo> _CacheList = new List<DocumentAuditInfo>();
|
||||||
protected static void AddToCache(DocumentAuditInfo documentAuditInfo)
|
protected static void AddToCache(DocumentAuditInfo documentAuditInfo)
|
||||||
{
|
{
|
||||||
if (!_CacheList.Contains(documentAuditInfo)) _CacheList.Add(documentAuditInfo); // In AddToCache
|
if (!_CacheList.Contains(documentAuditInfo)) _CacheList.Add(documentAuditInfo); // In AddToCache
|
||||||
}
|
}
|
||||||
protected static void RemoveFromCache(DocumentAuditInfo documentAuditInfo)
|
protected static void RemoveFromCache(DocumentAuditInfo documentAuditInfo)
|
||||||
{
|
{
|
||||||
while (_CacheList.Contains(documentAuditInfo)) _CacheList.Remove(documentAuditInfo); // In RemoveFromCache
|
while (_CacheList.Contains(documentAuditInfo)) _CacheList.Remove(documentAuditInfo); // In RemoveFromCache
|
||||||
}
|
}
|
||||||
private static Dictionary<string, List<DocumentAuditInfo>> _CacheByPrimaryKey = new Dictionary<string, List<DocumentAuditInfo>>();
|
private static Dictionary<string, List<DocumentAuditInfo>> _CacheByPrimaryKey = new Dictionary<string, List<DocumentAuditInfo>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
while (_CacheList.Count > 0) // Move DocumentAuditInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
while (_CacheList.Count > 0) // Move DocumentAuditInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
||||||
{
|
{
|
||||||
DocumentAuditInfo tmp = _CacheList[0]; // Get the first DocumentAuditInfo
|
DocumentAuditInfo tmp = _CacheList[0]; // Get the first DocumentAuditInfo
|
||||||
string pKey = tmp.AuditID.ToString();
|
string pKey = tmp.AuditID.ToString();
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
||||||
{
|
{
|
||||||
_CacheByPrimaryKey[pKey] = new List<DocumentAuditInfo>(); // Add new list for PrimaryKey
|
_CacheByPrimaryKey[pKey] = new List<DocumentAuditInfo>(); // Add new list for PrimaryKey
|
||||||
}
|
}
|
||||||
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
||||||
_CacheList.RemoveAt(0); // Remove the first DocumentAuditInfo
|
_CacheList.RemoveAt(0); // Remove the first DocumentAuditInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
internal static void AddList(DocumentAuditInfoList lst)
|
internal static void AddList(DocumentAuditInfoList lst)
|
||||||
{
|
{
|
||||||
foreach (DocumentAuditInfo item in lst) AddToCache(item);
|
foreach (DocumentAuditInfo item in lst) AddToCache(item);
|
||||||
}
|
}
|
||||||
protected static DocumentAuditInfo GetCachedByPrimaryKey(long auditID)
|
protected static DocumentAuditInfo GetCachedByPrimaryKey(long auditID)
|
||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = auditID.ToString();
|
string key = auditID.ToString();
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Business Methods
|
#region Business Methods
|
||||||
private string _ErrorMessage = string.Empty;
|
private string _ErrorMessage = string.Empty;
|
||||||
public string ErrorMessage
|
public string ErrorMessage
|
||||||
{
|
{
|
||||||
get { return _ErrorMessage; }
|
get { return _ErrorMessage; }
|
||||||
}
|
}
|
||||||
protected DocumentAudit _Editable;
|
protected DocumentAudit _Editable;
|
||||||
private IVEHasBrokenRules HasBrokenRules
|
private IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
IVEHasBrokenRules hasBrokenRules = null;
|
IVEHasBrokenRules hasBrokenRules = null;
|
||||||
if (_Editable != null)
|
if (_Editable != null)
|
||||||
hasBrokenRules = _Editable.HasBrokenRules;
|
hasBrokenRules = _Editable.HasBrokenRules;
|
||||||
return hasBrokenRules;
|
return hasBrokenRules;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private long _AuditID;
|
private long _AuditID;
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
public long AuditID
|
public long AuditID
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("AuditID", true);
|
return _AuditID;
|
||||||
return _AuditID;
|
}
|
||||||
}
|
}
|
||||||
}
|
private int _DocID;
|
||||||
private int _DocID;
|
public int DocID
|
||||||
public int DocID
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
get
|
||||||
get
|
{
|
||||||
{
|
return _DocID;
|
||||||
CanReadProperty("DocID", true);
|
}
|
||||||
return _DocID;
|
}
|
||||||
}
|
private string _LibTitle = string.Empty;
|
||||||
}
|
public string LibTitle
|
||||||
private string _LibTitle = string.Empty;
|
{
|
||||||
public string LibTitle
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
return _LibTitle;
|
||||||
{
|
}
|
||||||
CanReadProperty("LibTitle", true);
|
}
|
||||||
return _LibTitle;
|
private byte[] _DocContent;
|
||||||
}
|
public byte[] DocContent
|
||||||
}
|
{
|
||||||
private byte[] _DocContent;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
public byte[] DocContent
|
get
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
return _DocContent;
|
||||||
get
|
}
|
||||||
{
|
}
|
||||||
CanReadProperty("DocContent", true);
|
private string _DocAscii = string.Empty;
|
||||||
return _DocContent;
|
public string DocAscii
|
||||||
}
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
private string _DocAscii = string.Empty;
|
get
|
||||||
public string DocAscii
|
{
|
||||||
{
|
return _DocAscii;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
}
|
||||||
{
|
private string _Config = string.Empty;
|
||||||
CanReadProperty("DocAscii", true);
|
public string Config
|
||||||
return _DocAscii;
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
private string _Config = string.Empty;
|
{
|
||||||
public string Config
|
return _Config;
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
private DateTime _DTS = new DateTime();
|
||||||
{
|
public DateTime DTS
|
||||||
CanReadProperty("Config", true);
|
{
|
||||||
return _Config;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
}
|
{
|
||||||
private DateTime _DTS = new DateTime();
|
return _DTS;
|
||||||
public DateTime DTS
|
}
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
private string _UserID = string.Empty;
|
||||||
get
|
public string UserID
|
||||||
{
|
{
|
||||||
CanReadProperty("DTS", true);
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
return _DTS;
|
get
|
||||||
}
|
{
|
||||||
}
|
return _UserID;
|
||||||
private string _UserID = string.Empty;
|
}
|
||||||
public string UserID
|
}
|
||||||
{
|
private string _FileExtension = string.Empty;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
public string FileExtension
|
||||||
get
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
CanReadProperty("UserID", true);
|
get
|
||||||
return _UserID;
|
{
|
||||||
}
|
return _FileExtension;
|
||||||
}
|
}
|
||||||
private string _FileExtension = string.Empty;
|
}
|
||||||
public string FileExtension
|
private int _DeleteStatus;
|
||||||
{
|
public int DeleteStatus
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
CanReadProperty("FileExtension", true);
|
{
|
||||||
return _FileExtension;
|
return _DeleteStatus;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private int _DeleteStatus;
|
// CSLATODO: Replace base DocumentAuditInfo.ToString function as necessary
|
||||||
public int DeleteStatus
|
/// <summary>
|
||||||
{
|
/// Overrides Base ToString
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
/// </summary>
|
||||||
get
|
/// <returns>A string representation of current DocumentAuditInfo</returns>
|
||||||
{
|
//public override string ToString()
|
||||||
CanReadProperty("DeleteStatus", true);
|
//{
|
||||||
return _DeleteStatus;
|
// return base.ToString();
|
||||||
}
|
//}
|
||||||
}
|
// CSLATODO: Check DocumentAuditInfo.GetIdValue to assure that the ID returned is unique
|
||||||
// CSLATODO: Replace base DocumentAuditInfo.ToString function as necessary
|
/// <summary>
|
||||||
/// <summary>
|
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||||
/// Overrides Base ToString
|
/// </summary>
|
||||||
/// </summary>
|
/// <returns>A Unique ID for the current DocumentAuditInfo</returns>
|
||||||
/// <returns>A string representation of current DocumentAuditInfo</returns>
|
protected override object GetIdValue()
|
||||||
//public override string ToString()
|
{
|
||||||
//{
|
return MyDocumentAuditInfoUnique; // Absolutely Unique ID
|
||||||
// return base.ToString();
|
}
|
||||||
//}
|
#endregion
|
||||||
// CSLATODO: Check DocumentAuditInfo.GetIdValue to assure that the ID returned is unique
|
#region Factory Methods
|
||||||
/// <summary>
|
private static int _DocumentAuditInfoUnique = 0;
|
||||||
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
private static int DocumentAuditInfoUnique
|
||||||
/// </summary>
|
{ get { return ++_DocumentAuditInfoUnique; } }
|
||||||
/// <returns>A Unique ID for the current DocumentAuditInfo</returns>
|
private int _MyDocumentAuditInfoUnique = DocumentAuditInfoUnique;
|
||||||
protected override object GetIdValue()
|
public int MyDocumentAuditInfoUnique // Absolutely Unique ID - Info
|
||||||
{
|
{ get { return _MyDocumentAuditInfoUnique; } }
|
||||||
return MyDocumentAuditInfoUnique; // Absolutely Unique ID
|
protected DocumentAuditInfo()
|
||||||
}
|
{/* require use of factory methods */
|
||||||
#endregion
|
AddToCache(this);
|
||||||
#region Factory Methods
|
}
|
||||||
private static int _DocumentAuditInfoUnique = 0;
|
private bool _Disposed = false;
|
||||||
private static int DocumentAuditInfoUnique
|
private static int _CountCreated = 0;
|
||||||
{ get { return ++_DocumentAuditInfoUnique; } }
|
private static int _CountDisposed = 0;
|
||||||
private int _MyDocumentAuditInfoUnique = DocumentAuditInfoUnique;
|
private static int _CountFinalized = 0;
|
||||||
public int MyDocumentAuditInfoUnique // Absolutely Unique ID - Info
|
private static int IncrementCountCreated
|
||||||
{ get { return _MyDocumentAuditInfoUnique; } }
|
{ get { return ++_CountCreated; } }
|
||||||
protected DocumentAuditInfo()
|
private int _CountWhenCreated = IncrementCountCreated;
|
||||||
{/* require use of factory methods */
|
public static int CountCreated
|
||||||
AddToCache(this);
|
{ get { return _CountCreated; } }
|
||||||
}
|
public static int CountNotDisposed
|
||||||
private bool _Disposed = false;
|
{ get { return _CountCreated - _CountDisposed; } }
|
||||||
private static int _CountCreated = 0;
|
public static int CountNotFinalized
|
||||||
private static int _CountDisposed = 0;
|
{ get { return _CountCreated - _CountFinalized; } }
|
||||||
private static int _CountFinalized = 0;
|
~DocumentAuditInfo()
|
||||||
private static int IncrementCountCreated
|
{
|
||||||
{ get { return ++_CountCreated; } }
|
_CountFinalized++;
|
||||||
private int _CountWhenCreated = IncrementCountCreated;
|
}
|
||||||
public static int CountCreated
|
public void Dispose()
|
||||||
{ get { return _CountCreated; } }
|
{
|
||||||
public static int CountNotDisposed
|
if (_Disposed) return;
|
||||||
{ get { return _CountCreated - _CountDisposed; } }
|
_CountDisposed++;
|
||||||
public static int CountNotFinalized
|
_Disposed = true;
|
||||||
{ get { return _CountCreated - _CountFinalized; } }
|
RemoveFromCache(this);
|
||||||
~DocumentAuditInfo()
|
if (!_CacheByPrimaryKey.ContainsKey(AuditID.ToString())) return;
|
||||||
{
|
List<DocumentAuditInfo> listDocumentAuditInfo = _CacheByPrimaryKey[AuditID.ToString()]; // Get the list of items
|
||||||
_CountFinalized++;
|
while (listDocumentAuditInfo.Contains(this)) listDocumentAuditInfo.Remove(this); // Remove the item from the list
|
||||||
}
|
if (listDocumentAuditInfo.Count == 0) // If there are no items left in the list
|
||||||
public void Dispose()
|
_CacheByPrimaryKey.Remove(AuditID.ToString()); // remove the list
|
||||||
{
|
}
|
||||||
if (_Disposed) return;
|
public virtual DocumentAudit Get()
|
||||||
_CountDisposed++;
|
{
|
||||||
_Disposed = true;
|
return _Editable = DocumentAudit.Get(_AuditID);
|
||||||
RemoveFromCache(this);
|
}
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(AuditID.ToString())) return;
|
public static void Refresh(DocumentAudit tmp)
|
||||||
List<DocumentAuditInfo> listDocumentAuditInfo = _CacheByPrimaryKey[AuditID.ToString()]; // Get the list of items
|
{
|
||||||
while (listDocumentAuditInfo.Contains(this)) listDocumentAuditInfo.Remove(this); // Remove the item from the list
|
string key = tmp.AuditID.ToString();
|
||||||
if (listDocumentAuditInfo.Count == 0) // If there are no items left in the list
|
ConvertListToDictionary();
|
||||||
_CacheByPrimaryKey.Remove(AuditID.ToString()); // remove the list
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
}
|
foreach (DocumentAuditInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
public virtual DocumentAudit Get()
|
tmpInfo.RefreshFields(tmp);
|
||||||
{
|
}
|
||||||
return _Editable = DocumentAudit.Get(_AuditID);
|
protected virtual void RefreshFields(DocumentAudit tmp)
|
||||||
}
|
{
|
||||||
public static void Refresh(DocumentAudit tmp)
|
_DocID = tmp.DocID;
|
||||||
{
|
_LibTitle = tmp.LibTitle;
|
||||||
string key = tmp.AuditID.ToString();
|
_DocContent = tmp.DocContent;
|
||||||
ConvertListToDictionary();
|
_DocAscii = tmp.DocAscii;
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
_Config = tmp.Config;
|
||||||
foreach (DocumentAuditInfo tmpInfo in _CacheByPrimaryKey[key])
|
_DTS = tmp.DTS;
|
||||||
tmpInfo.RefreshFields(tmp);
|
_UserID = tmp.UserID;
|
||||||
}
|
_FileExtension = tmp.FileExtension;
|
||||||
protected virtual void RefreshFields(DocumentAudit tmp)
|
_DeleteStatus = tmp.DeleteStatus;
|
||||||
{
|
_DocumentAuditInfoExtension.Refresh(this);
|
||||||
_DocID = tmp.DocID;
|
OnChange();// raise an event
|
||||||
_LibTitle = tmp.LibTitle;
|
}
|
||||||
_DocContent = tmp.DocContent;
|
public static DocumentAuditInfo Get(long auditID)
|
||||||
_DocAscii = tmp.DocAscii;
|
{
|
||||||
_Config = tmp.Config;
|
//if (!CanGetObject())
|
||||||
_DTS = tmp.DTS;
|
// throw new System.Security.SecurityException("User not authorized to view a DocumentAudit");
|
||||||
_UserID = tmp.UserID;
|
try
|
||||||
_FileExtension = tmp.FileExtension;
|
{
|
||||||
_DeleteStatus = tmp.DeleteStatus;
|
DocumentAuditInfo tmp = GetCachedByPrimaryKey(auditID);
|
||||||
_DocumentAuditInfoExtension.Refresh(this);
|
if (tmp == null)
|
||||||
OnChange();// raise an event
|
{
|
||||||
}
|
tmp = DataPortal.Fetch<DocumentAuditInfo>(new PKCriteria(auditID));
|
||||||
public static DocumentAuditInfo Get(long auditID)
|
AddToCache(tmp);
|
||||||
{
|
}
|
||||||
//if (!CanGetObject())
|
if (tmp.ErrorMessage == "No Record Found")
|
||||||
// throw new System.Security.SecurityException("User not authorized to view a DocumentAudit");
|
{
|
||||||
try
|
tmp.Dispose(); // Clean-up DocumentAuditInfo
|
||||||
{
|
tmp = null;
|
||||||
DocumentAuditInfo tmp = GetCachedByPrimaryKey(auditID);
|
}
|
||||||
if (tmp == null)
|
return tmp;
|
||||||
{
|
}
|
||||||
tmp = DataPortal.Fetch<DocumentAuditInfo>(new PKCriteria(auditID));
|
catch (Exception ex)
|
||||||
AddToCache(tmp);
|
{
|
||||||
}
|
throw new DbCslaException("Error on DocumentAuditInfo.Get", ex);
|
||||||
if (tmp.ErrorMessage == "No Record Found")
|
}
|
||||||
{
|
}
|
||||||
tmp.Dispose(); // Clean-up DocumentAuditInfo
|
#endregion
|
||||||
tmp = null;
|
#region Data Access Portal
|
||||||
}
|
internal DocumentAuditInfo(SafeDataReader dr)
|
||||||
return tmp;
|
{
|
||||||
}
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocumentAuditInfo.Constructor", GetHashCode());
|
||||||
catch (Exception ex)
|
try
|
||||||
{
|
{
|
||||||
throw new DbCslaException("Error on DocumentAuditInfo.Get", ex);
|
ReadData(dr);
|
||||||
}
|
}
|
||||||
}
|
catch (Exception ex)
|
||||||
#endregion
|
{
|
||||||
#region Data Access Portal
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocumentAuditInfo.Constructor", ex);
|
||||||
internal DocumentAuditInfo(SafeDataReader dr)
|
throw new DbCslaException("DocumentAuditInfo.Constructor", ex);
|
||||||
{
|
}
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocumentAuditInfo.Constructor", GetHashCode());
|
}
|
||||||
try
|
[Serializable()]
|
||||||
{
|
protected class PKCriteria
|
||||||
ReadData(dr);
|
{
|
||||||
}
|
private long _AuditID;
|
||||||
catch (Exception ex)
|
public long AuditID
|
||||||
{
|
{ get { return _AuditID; } }
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocumentAuditInfo.Constructor", ex);
|
public PKCriteria(long auditID)
|
||||||
throw new DbCslaException("DocumentAuditInfo.Constructor", ex);
|
{
|
||||||
}
|
_AuditID = auditID;
|
||||||
}
|
}
|
||||||
[Serializable()]
|
}
|
||||||
protected class PKCriteria
|
private void ReadData(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
private long _AuditID;
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocumentAuditInfo.ReadData", GetHashCode());
|
||||||
public long AuditID
|
try
|
||||||
{ get { return _AuditID; } }
|
{
|
||||||
public PKCriteria(long auditID)
|
_AuditID = dr.GetInt64("AuditID");
|
||||||
{
|
_DocID = dr.GetInt32("DocID");
|
||||||
_AuditID = auditID;
|
_LibTitle = dr.GetString("LibTitle");
|
||||||
}
|
_DocContent = (byte[])dr.GetValue("DocContent");
|
||||||
}
|
_DocAscii = dr.GetString("DocAscii");
|
||||||
private void ReadData(SafeDataReader dr)
|
_Config = dr.GetString("Config");
|
||||||
{
|
_DTS = dr.GetDateTime("DTS");
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocumentAuditInfo.ReadData", GetHashCode());
|
_UserID = dr.GetString("UserID");
|
||||||
try
|
_FileExtension = dr.GetString("FileExtension");
|
||||||
{
|
_DeleteStatus = dr.GetInt32("DeleteStatus");
|
||||||
_AuditID = dr.GetInt64("AuditID");
|
}
|
||||||
_DocID = dr.GetInt32("DocID");
|
catch (Exception ex)
|
||||||
_LibTitle = dr.GetString("LibTitle");
|
{
|
||||||
_DocContent = (byte[])dr.GetValue("DocContent");
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocumentAuditInfo.ReadData", ex);
|
||||||
_DocAscii = dr.GetString("DocAscii");
|
_ErrorMessage = ex.Message;
|
||||||
_Config = dr.GetString("Config");
|
throw new DbCslaException("DocumentAuditInfo.ReadData", ex);
|
||||||
_DTS = dr.GetDateTime("DTS");
|
}
|
||||||
_UserID = dr.GetString("UserID");
|
}
|
||||||
_FileExtension = dr.GetString("FileExtension");
|
private void DataPortal_Fetch(PKCriteria criteria)
|
||||||
_DeleteStatus = dr.GetInt32("DeleteStatus");
|
{
|
||||||
}
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocumentAuditInfo.DataPortal_Fetch", GetHashCode());
|
||||||
catch (Exception ex)
|
try
|
||||||
{
|
{
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocumentAuditInfo.ReadData", ex);
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
_ErrorMessage = ex.Message;
|
{
|
||||||
throw new DbCslaException("DocumentAuditInfo.ReadData", ex);
|
ApplicationContext.LocalContext["cn"] = cn;
|
||||||
}
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
}
|
{
|
||||||
private void DataPortal_Fetch(PKCriteria criteria)
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
{
|
cm.CommandText = "getDocumentAudit";
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocumentAuditInfo.DataPortal_Fetch", GetHashCode());
|
cm.Parameters.AddWithValue("@AuditID", criteria.AuditID);
|
||||||
try
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
{
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
{
|
||||||
{
|
if (!dr.Read())
|
||||||
ApplicationContext.LocalContext["cn"] = cn;
|
{
|
||||||
using (SqlCommand cm = cn.CreateCommand())
|
_ErrorMessage = "No Record Found";
|
||||||
{
|
return;
|
||||||
cm.CommandType = CommandType.StoredProcedure;
|
}
|
||||||
cm.CommandText = "getDocumentAudit";
|
ReadData(dr);
|
||||||
cm.Parameters.AddWithValue("@AuditID", criteria.AuditID);
|
}
|
||||||
cm.CommandTimeout = Database.DefaultTimeout;
|
}
|
||||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
// removing of item only needed for local data portal
|
||||||
{
|
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
||||||
if (!dr.Read())
|
ApplicationContext.LocalContext.Remove("cn");
|
||||||
{
|
}
|
||||||
_ErrorMessage = "No Record Found";
|
}
|
||||||
return;
|
catch (Exception ex)
|
||||||
}
|
{
|
||||||
ReadData(dr);
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocumentAuditInfo.DataPortal_Fetch", ex);
|
||||||
}
|
_ErrorMessage = ex.Message;
|
||||||
}
|
throw new DbCslaException("DocumentAuditInfo.DataPortal_Fetch", ex);
|
||||||
// removing of item only needed for local data portal
|
}
|
||||||
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
}
|
||||||
ApplicationContext.LocalContext.Remove("cn");
|
#endregion
|
||||||
}
|
// Standard Refresh
|
||||||
}
|
#region extension
|
||||||
catch (Exception ex)
|
DocumentAuditInfoExtension _DocumentAuditInfoExtension = new DocumentAuditInfoExtension();
|
||||||
{
|
[Serializable()]
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocumentAuditInfo.DataPortal_Fetch", ex);
|
partial class DocumentAuditInfoExtension : extensionBase { }
|
||||||
_ErrorMessage = ex.Message;
|
[Serializable()]
|
||||||
throw new DbCslaException("DocumentAuditInfo.DataPortal_Fetch", ex);
|
class extensionBase
|
||||||
}
|
{
|
||||||
}
|
// Default Refresh
|
||||||
#endregion
|
public virtual void Refresh(DocumentAuditInfo tmp) { }
|
||||||
// Standard Refresh
|
}
|
||||||
#region extension
|
#endregion
|
||||||
DocumentAuditInfoExtension _DocumentAuditInfoExtension = new DocumentAuditInfoExtension();
|
} // Class
|
||||||
[Serializable()]
|
#region Converter
|
||||||
partial class DocumentAuditInfoExtension : extensionBase { }
|
internal class DocumentAuditInfoConverter : ExpandableObjectConverter
|
||||||
[Serializable()]
|
{
|
||||||
class extensionBase
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
{
|
{
|
||||||
// Default Refresh
|
if (destType == typeof(string) && value is DocumentAuditInfo)
|
||||||
public virtual void Refresh(DocumentAuditInfo tmp) { }
|
{
|
||||||
}
|
// Return the ToString value
|
||||||
#endregion
|
return ((DocumentAuditInfo)value).ToString();
|
||||||
} // Class
|
}
|
||||||
#region Converter
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
internal class DocumentAuditInfoConverter : ExpandableObjectConverter
|
}
|
||||||
{
|
}
|
||||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
#endregion
|
||||||
{
|
|
||||||
if (destType == typeof(string) && value is DocumentAuditInfo)
|
|
||||||
{
|
|
||||||
// Return the ToString value
|
|
||||||
return ((DocumentAuditInfo)value).ToString();
|
|
||||||
}
|
|
||||||
return base.ConvertTo(context, culture, value, destType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -20,458 +20,445 @@ using System.Collections.Generic;
|
|||||||
using Csla.Validation;
|
using Csla.Validation;
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// DocumentEntry Generated by MyGeneration using the CSLA Object Mapping template
|
/// DocumentEntry Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
[TypeConverter(typeof(DocumentEntryConverter))]
|
[TypeConverter(typeof(DocumentEntryConverter))]
|
||||||
public partial class DocumentEntry : BusinessBase<DocumentEntry>, IVEHasBrokenRules, IDisposable
|
public partial class DocumentEntry : BusinessBase<DocumentEntry>, IVEHasBrokenRules, IDisposable
|
||||||
{
|
{
|
||||||
#region Log4Net
|
#region Log4Net
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#endregion
|
#endregion
|
||||||
#region Business Methods
|
#region Business Methods
|
||||||
private string _ErrorMessage = string.Empty;
|
private string _ErrorMessage = string.Empty;
|
||||||
public string ErrorMessage
|
public string ErrorMessage
|
||||||
{
|
{
|
||||||
get { return _ErrorMessage; }
|
get { return _ErrorMessage; }
|
||||||
}
|
}
|
||||||
private int _ContentID;
|
private int _ContentID;
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
public int ContentID
|
public int ContentID
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("ContentID", true);
|
if (_MyEntry != null) _ContentID = _MyEntry.ContentID;
|
||||||
if (_MyEntry != null) _ContentID = _MyEntry.ContentID;
|
return _ContentID;
|
||||||
return _ContentID;
|
}
|
||||||
}
|
}
|
||||||
}
|
private Entry _MyEntry;
|
||||||
private Entry _MyEntry;
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
public Entry MyEntry
|
||||||
public Entry MyEntry
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
get
|
||||||
get
|
{
|
||||||
{
|
if (_MyEntry == null && _ContentID != 0) _MyEntry = Entry.Get(_ContentID);
|
||||||
CanReadProperty("MyEntry", true);
|
return _MyEntry;
|
||||||
if (_MyEntry == null && _ContentID != 0) _MyEntry = Entry.Get(_ContentID);
|
}
|
||||||
return _MyEntry;
|
}
|
||||||
}
|
private DateTime _DTS = new DateTime();
|
||||||
}
|
public DateTime DTS
|
||||||
private DateTime _DTS = new DateTime();
|
{
|
||||||
public DateTime DTS
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
return _DTS;
|
||||||
{
|
}
|
||||||
CanReadProperty("DTS", true);
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
return _DTS;
|
set
|
||||||
}
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
if (_DTS != value)
|
||||||
set
|
{
|
||||||
{
|
_DTS = value;
|
||||||
CanWriteProperty("DTS", true);
|
PropertyHasChanged();
|
||||||
if (_DTS != value)
|
}
|
||||||
{
|
}
|
||||||
_DTS = value;
|
}
|
||||||
PropertyHasChanged();
|
private string _UserID = string.Empty;
|
||||||
}
|
public string UserID
|
||||||
}
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
private string _UserID = string.Empty;
|
get
|
||||||
public string UserID
|
{
|
||||||
{
|
return _UserID;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
set
|
||||||
CanReadProperty("UserID", true);
|
{
|
||||||
return _UserID;
|
if (value == null) value = string.Empty;
|
||||||
}
|
if (_UserID != value)
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
set
|
_UserID = value;
|
||||||
{
|
PropertyHasChanged();
|
||||||
CanWriteProperty("UserID", true);
|
}
|
||||||
if (value == null) value = string.Empty;
|
}
|
||||||
if (_UserID != value)
|
}
|
||||||
{
|
private byte[] _LastChanged = new byte[8];//timestamp
|
||||||
_UserID = value;
|
private string _Content_Number = string.Empty;
|
||||||
PropertyHasChanged();
|
/// <summary>
|
||||||
}
|
/// Increased from 30 to 256 to support RTF symbols
|
||||||
}
|
/// </summary>
|
||||||
}
|
public string Content_Number
|
||||||
private byte[] _LastChanged = new byte[8];//timestamp
|
{
|
||||||
private string _Content_Number = string.Empty;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
/// <summary>
|
get
|
||||||
/// Increased from 30 to 256 to support RTF symbols
|
{
|
||||||
/// </summary>
|
return _Content_Number;
|
||||||
public string Content_Number
|
}
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
private string _Content_Text = string.Empty;
|
||||||
get
|
public string Content_Text
|
||||||
{
|
{
|
||||||
CanReadProperty("Content_Number", true);
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
return _Content_Number;
|
get
|
||||||
}
|
{
|
||||||
}
|
return _Content_Text;
|
||||||
private string _Content_Text = string.Empty;
|
}
|
||||||
public string Content_Text
|
}
|
||||||
{
|
private int? _Content_Type;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
/// <summary>
|
||||||
get
|
/// 0 - Procedure, 10000 - Section, 20000 Step
|
||||||
{
|
/// </summary>
|
||||||
CanReadProperty("Content_Text", true);
|
public int? Content_Type
|
||||||
return _Content_Text;
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
private int? _Content_Type;
|
{
|
||||||
/// <summary>
|
return _Content_Type;
|
||||||
/// 0 - Procedure, 10000 - Section, 20000 Step
|
}
|
||||||
/// </summary>
|
}
|
||||||
public int? Content_Type
|
private int? _Content_FormatID;
|
||||||
{
|
public int? Content_FormatID
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
CanReadProperty("Content_Type", true);
|
{
|
||||||
return _Content_Type;
|
return _Content_FormatID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private int? _Content_FormatID;
|
private string _Content_Config = string.Empty;
|
||||||
public int? Content_FormatID
|
public string Content_Config
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("Content_FormatID", true);
|
return _Content_Config;
|
||||||
return _Content_FormatID;
|
}
|
||||||
}
|
}
|
||||||
}
|
private DateTime _Content_DTS = new DateTime();
|
||||||
private string _Content_Config = string.Empty;
|
public DateTime Content_DTS
|
||||||
public string Content_Config
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
get
|
||||||
get
|
{
|
||||||
{
|
return _Content_DTS;
|
||||||
CanReadProperty("Content_Config", true);
|
}
|
||||||
return _Content_Config;
|
}
|
||||||
}
|
private string _Content_UserID = string.Empty;
|
||||||
}
|
public string Content_UserID
|
||||||
private DateTime _Content_DTS = new DateTime();
|
{
|
||||||
public DateTime Content_DTS
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
return _Content_UserID;
|
||||||
{
|
}
|
||||||
CanReadProperty("Content_DTS", true);
|
}
|
||||||
return _Content_DTS;
|
// CSLATODO: Check DocumentEntry.GetIdValue to assure that the ID returned is unique
|
||||||
}
|
/// <summary>
|
||||||
}
|
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||||
private string _Content_UserID = string.Empty;
|
/// </summary>
|
||||||
public string Content_UserID
|
/// <returns>A Unique ID for the current DocumentEntry</returns>
|
||||||
{
|
protected override object GetIdValue()
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
return MyDocumentEntryUnique; // Absolutely Unique ID
|
||||||
{
|
}
|
||||||
CanReadProperty("Content_UserID", true);
|
// CSLATODO: Replace base DocumentEntry.ToString function as necessary
|
||||||
return _Content_UserID;
|
/// <summary>
|
||||||
}
|
/// Overrides Base ToString
|
||||||
}
|
/// </summary>
|
||||||
// CSLATODO: Check DocumentEntry.GetIdValue to assure that the ID returned is unique
|
/// <returns>A string representation of current DocumentEntry</returns>
|
||||||
/// <summary>
|
//public override string ToString()
|
||||||
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
//{
|
||||||
/// </summary>
|
// return base.ToString();
|
||||||
/// <returns>A Unique ID for the current DocumentEntry</returns>
|
//}
|
||||||
protected override object GetIdValue()
|
public override bool IsDirty
|
||||||
{
|
{
|
||||||
return MyDocumentEntryUnique; // Absolutely Unique ID
|
get { return base.IsDirty; }
|
||||||
}
|
}
|
||||||
// CSLATODO: Replace base DocumentEntry.ToString function as necessary
|
public bool IsDirtyList(List<object> list)
|
||||||
/// <summary>
|
{
|
||||||
/// Overrides Base ToString
|
return base.IsDirty;
|
||||||
/// </summary>
|
}
|
||||||
/// <returns>A string representation of current DocumentEntry</returns>
|
public override bool IsValid
|
||||||
//public override string ToString()
|
{
|
||||||
//{
|
get { return (IsNew && !IsDirty) ? true : base.IsValid; }
|
||||||
// return base.ToString();
|
}
|
||||||
//}
|
public bool IsValidList(List<object> list)
|
||||||
public override bool IsDirty
|
{
|
||||||
{
|
return (IsNew && !IsDirty) ? true : base.IsValid;
|
||||||
get { return base.IsDirty; }
|
}
|
||||||
}
|
#endregion
|
||||||
public bool IsDirtyList(List<object> list)
|
#region ValidationRules
|
||||||
{
|
[NonSerialized]
|
||||||
return base.IsDirty;
|
private bool _CheckingBrokenRules = false;
|
||||||
}
|
public IVEHasBrokenRules HasBrokenRules
|
||||||
public override bool IsValid
|
{
|
||||||
{
|
get
|
||||||
get { return (IsNew && !IsDirty) ? true : base.IsValid; }
|
{
|
||||||
}
|
if (_CheckingBrokenRules) return null;
|
||||||
public bool IsValidList(List<object> list)
|
if (BrokenRulesCollection.Count > 0) return this;
|
||||||
{
|
try
|
||||||
return (IsNew && !IsDirty) ? true : base.IsValid;
|
{
|
||||||
}
|
_CheckingBrokenRules = true;
|
||||||
#endregion
|
IVEHasBrokenRules hasBrokenRules = null;
|
||||||
#region ValidationRules
|
return hasBrokenRules;
|
||||||
[NonSerialized]
|
}
|
||||||
private bool _CheckingBrokenRules = false;
|
finally
|
||||||
public IVEHasBrokenRules HasBrokenRules
|
{
|
||||||
{
|
_CheckingBrokenRules = false;
|
||||||
get
|
}
|
||||||
{
|
}
|
||||||
if (_CheckingBrokenRules) return null;
|
}
|
||||||
if (BrokenRulesCollection.Count > 0) return this;
|
public BrokenRulesCollection BrokenRules
|
||||||
try
|
{
|
||||||
{
|
get
|
||||||
_CheckingBrokenRules = true;
|
{
|
||||||
IVEHasBrokenRules hasBrokenRules = null;
|
IVEHasBrokenRules hasBrokenRules = HasBrokenRules;
|
||||||
return hasBrokenRules;
|
if (this.Equals(hasBrokenRules)) return BrokenRulesCollection;
|
||||||
}
|
return (hasBrokenRules != null ? hasBrokenRules.BrokenRules : null);
|
||||||
finally
|
}
|
||||||
{
|
}
|
||||||
_CheckingBrokenRules = false;
|
protected override void AddBusinessRules()
|
||||||
}
|
{
|
||||||
}
|
ValidationRules.AddRule(
|
||||||
}
|
Csla.Validation.CommonRules.StringRequired, "UserID");
|
||||||
public BrokenRulesCollection BrokenRules
|
ValidationRules.AddRule(
|
||||||
{
|
Csla.Validation.CommonRules.StringMaxLength,
|
||||||
get
|
new Csla.Validation.CommonRules.MaxLengthRuleArgs("UserID", 100));
|
||||||
{
|
// CSLATODO: Add other validation rules
|
||||||
IVEHasBrokenRules hasBrokenRules = HasBrokenRules;
|
}
|
||||||
if (this.Equals(hasBrokenRules)) return BrokenRulesCollection;
|
// Sample data comparison validation rule
|
||||||
return (hasBrokenRules != null ? hasBrokenRules.BrokenRules : null);
|
//private bool StartDateGTEndDate(object target, Csla.Validation.RuleArgs e)
|
||||||
}
|
//{
|
||||||
}
|
// if (_started > _ended)
|
||||||
protected override void AddBusinessRules()
|
// {
|
||||||
{
|
// e.Description = "Start date can't be after end date";
|
||||||
ValidationRules.AddRule(
|
// return false;
|
||||||
Csla.Validation.CommonRules.StringRequired, "UserID");
|
// }
|
||||||
ValidationRules.AddRule(
|
// else
|
||||||
Csla.Validation.CommonRules.StringMaxLength,
|
// return true;
|
||||||
new Csla.Validation.CommonRules.MaxLengthRuleArgs("UserID", 100));
|
//}
|
||||||
// CSLATODO: Add other validation rules
|
#endregion
|
||||||
}
|
#region Authorization Rules
|
||||||
// Sample data comparison validation rule
|
protected override void AddAuthorizationRules()
|
||||||
//private bool StartDateGTEndDate(object target, Csla.Validation.RuleArgs e)
|
{
|
||||||
//{
|
//CSLATODO: Who can read/write which fields
|
||||||
// if (_started > _ended)
|
//AuthorizationRules.AllowRead(ContentID, "<Role(s)>");
|
||||||
// {
|
//AuthorizationRules.AllowRead(DTS, "<Role(s)>");
|
||||||
// e.Description = "Start date can't be after end date";
|
//AuthorizationRules.AllowWrite(DTS, "<Role(s)>");
|
||||||
// return false;
|
//AuthorizationRules.AllowRead(UserID, "<Role(s)>");
|
||||||
// }
|
//AuthorizationRules.AllowWrite(UserID, "<Role(s)>");
|
||||||
// else
|
}
|
||||||
// return true;
|
public static bool CanAddObject()
|
||||||
//}
|
{
|
||||||
#endregion
|
// CSLATODO: Can Add Authorization
|
||||||
#region Authorization Rules
|
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
|
||||||
protected override void AddAuthorizationRules()
|
return true;
|
||||||
{
|
}
|
||||||
//CSLATODO: Who can read/write which fields
|
public static bool CanGetObject()
|
||||||
//AuthorizationRules.AllowRead(ContentID, "<Role(s)>");
|
{
|
||||||
//AuthorizationRules.AllowRead(DTS, "<Role(s)>");
|
// CSLATODO: CanGet Authorization
|
||||||
//AuthorizationRules.AllowWrite(DTS, "<Role(s)>");
|
return true;
|
||||||
//AuthorizationRules.AllowRead(UserID, "<Role(s)>");
|
}
|
||||||
//AuthorizationRules.AllowWrite(UserID, "<Role(s)>");
|
public static bool CanDeleteObject()
|
||||||
}
|
{
|
||||||
public static bool CanAddObject()
|
// CSLATODO: CanDelete Authorization
|
||||||
{
|
//bool result = false;
|
||||||
// CSLATODO: Can Add Authorization
|
//if (Csla.ApplicationContext.User.IsInRole("ProjectManager"))result = true;
|
||||||
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
|
//if (Csla.ApplicationContext.User.IsInRole("Administrator"))result = true;
|
||||||
return true;
|
//return result;
|
||||||
}
|
return true;
|
||||||
public static bool CanGetObject()
|
}
|
||||||
{
|
public static bool CanEditObject()
|
||||||
// CSLATODO: CanGet Authorization
|
{
|
||||||
return true;
|
// CSLATODO: CanEdit Authorization
|
||||||
}
|
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
|
||||||
public static bool CanDeleteObject()
|
return true;
|
||||||
{
|
}
|
||||||
// CSLATODO: CanDelete Authorization
|
#endregion
|
||||||
//bool result = false;
|
#region Factory Methods
|
||||||
//if (Csla.ApplicationContext.User.IsInRole("ProjectManager"))result = true;
|
public int CurrentEditLevel
|
||||||
//if (Csla.ApplicationContext.User.IsInRole("Administrator"))result = true;
|
{ get { return EditLevel; } }
|
||||||
//return result;
|
private static int _DocumentEntryUnique = 0;
|
||||||
return true;
|
private static int DocumentEntryUnique
|
||||||
}
|
{ get { return ++_DocumentEntryUnique; } }
|
||||||
public static bool CanEditObject()
|
private int _MyDocumentEntryUnique = DocumentEntryUnique;
|
||||||
{
|
public int MyDocumentEntryUnique // Absolutely Unique ID - Editable FK
|
||||||
// CSLATODO: CanEdit Authorization
|
{ get { return _MyDocumentEntryUnique; } }
|
||||||
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
|
internal static DocumentEntry New(Entry myEntry)
|
||||||
return true;
|
{
|
||||||
}
|
return new DocumentEntry(myEntry);
|
||||||
#endregion
|
}
|
||||||
#region Factory Methods
|
internal static DocumentEntry Get(SafeDataReader dr)
|
||||||
public int CurrentEditLevel
|
{
|
||||||
{ get { return EditLevel; } }
|
return new DocumentEntry(dr);
|
||||||
private static int _DocumentEntryUnique = 0;
|
}
|
||||||
private static int DocumentEntryUnique
|
public DocumentEntry()
|
||||||
{ get { return ++_DocumentEntryUnique; } }
|
{
|
||||||
private int _MyDocumentEntryUnique = DocumentEntryUnique;
|
MarkAsChild();
|
||||||
public int MyDocumentEntryUnique // Absolutely Unique ID - Editable FK
|
|
||||||
{ get { return _MyDocumentEntryUnique; } }
|
|
||||||
internal static DocumentEntry New(Entry myEntry)
|
|
||||||
{
|
|
||||||
return new DocumentEntry(myEntry);
|
|
||||||
}
|
|
||||||
internal static DocumentEntry Get(SafeDataReader dr)
|
|
||||||
{
|
|
||||||
return new DocumentEntry(dr);
|
|
||||||
}
|
|
||||||
public DocumentEntry()
|
|
||||||
{
|
|
||||||
MarkAsChild();
|
|
||||||
|
|
||||||
_DTS = _DocumentEntryExtension.DefaultDTS;
|
_DTS = _DocumentEntryExtension.DefaultDTS;
|
||||||
_UserID = _DocumentEntryExtension.DefaultUserID;
|
_UserID = _DocumentEntryExtension.DefaultUserID;
|
||||||
ValidationRules.CheckRules();
|
ValidationRules.CheckRules();
|
||||||
}
|
}
|
||||||
private DocumentEntry(Entry myEntry)
|
private DocumentEntry(Entry myEntry)
|
||||||
{
|
{
|
||||||
MarkAsChild();
|
MarkAsChild();
|
||||||
// CSLATODO: Add any initialization & defaults
|
// CSLATODO: Add any initialization & defaults
|
||||||
_DTS = _DocumentEntryExtension.DefaultDTS;
|
_DTS = _DocumentEntryExtension.DefaultDTS;
|
||||||
_UserID = _DocumentEntryExtension.DefaultUserID;
|
_UserID = _DocumentEntryExtension.DefaultUserID;
|
||||||
_MyEntry = myEntry;
|
_MyEntry = myEntry;
|
||||||
ValidationRules.CheckRules();
|
ValidationRules.CheckRules();
|
||||||
}
|
}
|
||||||
internal DocumentEntry(SafeDataReader dr)
|
internal DocumentEntry(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
MarkAsChild();
|
MarkAsChild();
|
||||||
Fetch(dr);
|
Fetch(dr);
|
||||||
}
|
}
|
||||||
private bool _Disposed = false;
|
private bool _Disposed = false;
|
||||||
private static int _CountCreated = 0;
|
private static int _CountCreated = 0;
|
||||||
private static int _CountDisposed = 0;
|
private static int _CountDisposed = 0;
|
||||||
private static int _CountFinalized = 0;
|
private static int _CountFinalized = 0;
|
||||||
private static int IncrementCountCreated
|
private static int IncrementCountCreated
|
||||||
{ get { return ++_CountCreated; } }
|
{ get { return ++_CountCreated; } }
|
||||||
private int _CountWhenCreated = IncrementCountCreated;
|
private int _CountWhenCreated = IncrementCountCreated;
|
||||||
public static int CountCreated
|
public static int CountCreated
|
||||||
{ get { return _CountCreated; } }
|
{ get { return _CountCreated; } }
|
||||||
public static int CountNotDisposed
|
public static int CountNotDisposed
|
||||||
{ get { return _CountCreated - _CountDisposed; } }
|
{ get { return _CountCreated - _CountDisposed; } }
|
||||||
public static int CountNotFinalized
|
public static int CountNotFinalized
|
||||||
{ get { return _CountCreated - _CountFinalized; } }
|
{ get { return _CountCreated - _CountFinalized; } }
|
||||||
~DocumentEntry()
|
~DocumentEntry()
|
||||||
{
|
{
|
||||||
_CountFinalized++;
|
_CountFinalized++;
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
if (_Disposed) return;
|
if (_Disposed) return;
|
||||||
_CountDisposed++;
|
_CountDisposed++;
|
||||||
_Disposed = true;
|
_Disposed = true;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Data Access Portal
|
#region Data Access Portal
|
||||||
private void Fetch(SafeDataReader dr)
|
private void Fetch(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocumentEntry.FetchDR", GetHashCode());
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocumentEntry.FetchDR", GetHashCode());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_ContentID = dr.GetInt32("ContentID");
|
_ContentID = dr.GetInt32("ContentID");
|
||||||
_DTS = dr.GetDateTime("DTS");
|
_DTS = dr.GetDateTime("DTS");
|
||||||
_UserID = dr.GetString("UserID");
|
_UserID = dr.GetString("UserID");
|
||||||
dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
|
dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
|
||||||
_Content_Number = dr.GetString("Content_Number");
|
_Content_Number = dr.GetString("Content_Number");
|
||||||
_Content_Text = dr.GetString("Content_Text");
|
_Content_Text = dr.GetString("Content_Text");
|
||||||
_Content_Type = (int?)dr.GetValue("Content_Type");
|
_Content_Type = (int?)dr.GetValue("Content_Type");
|
||||||
_Content_FormatID = (int?)dr.GetValue("Content_FormatID");
|
_Content_FormatID = (int?)dr.GetValue("Content_FormatID");
|
||||||
_Content_Config = dr.GetString("Content_Config");
|
_Content_Config = dr.GetString("Content_Config");
|
||||||
_Content_DTS = dr.GetDateTime("Content_DTS");
|
_Content_DTS = dr.GetDateTime("Content_DTS");
|
||||||
_Content_UserID = dr.GetString("Content_UserID");
|
_Content_UserID = dr.GetString("Content_UserID");
|
||||||
}
|
}
|
||||||
catch (Exception ex) // FKItem Fetch
|
catch (Exception ex) // FKItem Fetch
|
||||||
{
|
{
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocumentEntry.FetchDR", ex);
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocumentEntry.FetchDR", ex);
|
||||||
throw new DbCslaException("DocumentEntry.Fetch", ex);
|
throw new DbCslaException("DocumentEntry.Fetch", ex);
|
||||||
}
|
}
|
||||||
MarkOld();
|
MarkOld();
|
||||||
}
|
}
|
||||||
internal void Insert(Document myDocument)
|
internal void Insert(Document myDocument)
|
||||||
{
|
{
|
||||||
// if we're not dirty then don't update the database
|
// if we're not dirty then don't update the database
|
||||||
if (!this.IsDirty) return;
|
if (!this.IsDirty) return;
|
||||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||||
_LastChanged = Entry.Add(cn, _MyEntry.MyContent, myDocument, _DTS, _UserID);
|
_LastChanged = Entry.Add(cn, _MyEntry.MyContent, myDocument, _DTS, _UserID);
|
||||||
MarkOld();
|
MarkOld();
|
||||||
}
|
}
|
||||||
internal void Update(Document myDocument)
|
internal void Update(Document myDocument)
|
||||||
{
|
{
|
||||||
// if we're not dirty then don't update the database
|
// if we're not dirty then don't update the database
|
||||||
if (!this.IsDirty) return;
|
if (!this.IsDirty) return;
|
||||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||||
_LastChanged = Entry.Update(cn, _ContentID, myDocument.DocID, _DTS, _UserID, ref _LastChanged);
|
_LastChanged = Entry.Update(cn, _ContentID, myDocument.DocID, _DTS, _UserID, ref _LastChanged);
|
||||||
MarkOld();
|
MarkOld();
|
||||||
}
|
}
|
||||||
internal void DeleteSelf(Document myDocument)
|
internal void DeleteSelf(Document myDocument)
|
||||||
{
|
{
|
||||||
// if we're not dirty then don't update the database
|
// if we're not dirty then don't update the database
|
||||||
if (!this.IsDirty) return;
|
if (!this.IsDirty) return;
|
||||||
// if we're new then don't update the database
|
// if we're new then don't update the database
|
||||||
if (this.IsNew) return;
|
if (this.IsNew) return;
|
||||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||||
Entry.Remove(cn, _ContentID);
|
Entry.Remove(cn, _ContentID);
|
||||||
MarkNew();
|
MarkNew();
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
// Standard Default Code
|
// Standard Default Code
|
||||||
#region extension
|
#region extension
|
||||||
DocumentEntryExtension _DocumentEntryExtension = new DocumentEntryExtension();
|
DocumentEntryExtension _DocumentEntryExtension = new DocumentEntryExtension();
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
partial class DocumentEntryExtension : extensionBase
|
partial class DocumentEntryExtension : extensionBase
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
class extensionBase
|
class extensionBase
|
||||||
{
|
{
|
||||||
// Default Values
|
// Default Values
|
||||||
public virtual DateTime DefaultDTS
|
public virtual DateTime DefaultDTS
|
||||||
{
|
{
|
||||||
get { return DateTime.Now; }
|
get { return DateTime.Now; }
|
||||||
}
|
}
|
||||||
public virtual string DefaultUserID
|
public virtual string DefaultUserID
|
||||||
{
|
{
|
||||||
get { return Volian.Base.Library.VlnSettings.UserID; }
|
get { return Volian.Base.Library.VlnSettings.UserID; }
|
||||||
}
|
}
|
||||||
// Authorization Rules
|
// Authorization Rules
|
||||||
public virtual void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
|
public virtual void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
|
||||||
{
|
{
|
||||||
// Needs to be overriden to add new authorization rules
|
// Needs to be overriden to add new authorization rules
|
||||||
}
|
}
|
||||||
// Instance Authorization Rules
|
// Instance Authorization Rules
|
||||||
public virtual void AddInstanceAuthorizationRules(Csla.Security.AuthorizationRules rules)
|
public virtual void AddInstanceAuthorizationRules(Csla.Security.AuthorizationRules rules)
|
||||||
{
|
{
|
||||||
// Needs to be overriden to add new authorization rules
|
// Needs to be overriden to add new authorization rules
|
||||||
}
|
}
|
||||||
// Validation Rules
|
// Validation Rules
|
||||||
public virtual void AddValidationRules(Csla.Validation.ValidationRules rules)
|
public virtual void AddValidationRules(Csla.Validation.ValidationRules rules)
|
||||||
{
|
{
|
||||||
// Needs to be overriden to add new validation rules
|
// Needs to be overriden to add new validation rules
|
||||||
}
|
}
|
||||||
// InstanceValidation Rules
|
// InstanceValidation Rules
|
||||||
public virtual void AddInstanceValidationRules(Csla.Validation.ValidationRules rules)
|
public virtual void AddInstanceValidationRules(Csla.Validation.ValidationRules rules)
|
||||||
{
|
{
|
||||||
// Needs to be overriden to add new validation rules
|
// Needs to be overriden to add new validation rules
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
} // Class
|
} // Class
|
||||||
#region Converter
|
#region Converter
|
||||||
internal class DocumentEntryConverter : ExpandableObjectConverter
|
internal class DocumentEntryConverter : ExpandableObjectConverter
|
||||||
{
|
{
|
||||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
{
|
{
|
||||||
if (destType == typeof(string) && value is DocumentEntry)
|
if (destType == typeof(string) && value is DocumentEntry)
|
||||||
{
|
{
|
||||||
// Return the ToString value
|
// Return the ToString value
|
||||||
return ((DocumentEntry)value).ToString();
|
return ((DocumentEntry)value).ToString();
|
||||||
}
|
}
|
||||||
return base.ConvertTo(context, culture, value, destType);
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,496 +19,482 @@ using System.ComponentModel;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
public delegate void DocumentInfoEvent(object sender);
|
public delegate void DocumentInfoEvent(object sender);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// DocumentInfo Generated by MyGeneration using the CSLA Object Mapping template
|
/// DocumentInfo Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
[TypeConverter(typeof(DocumentInfoConverter))]
|
[TypeConverter(typeof(DocumentInfoConverter))]
|
||||||
public partial class DocumentInfo : ReadOnlyBase<DocumentInfo>, IDisposable
|
public partial class DocumentInfo : ReadOnlyBase<DocumentInfo>, IDisposable
|
||||||
{
|
{
|
||||||
public event DocumentInfoEvent Changed;
|
public event DocumentInfoEvent Changed;
|
||||||
private void OnChange()
|
private void OnChange()
|
||||||
{
|
{
|
||||||
if (Changed != null) Changed(this);
|
if (Changed != null) Changed(this);
|
||||||
}
|
}
|
||||||
#region Log4Net
|
#region Log4Net
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
private static List<DocumentInfo> _CacheList = new List<DocumentInfo>();
|
private static List<DocumentInfo> _CacheList = new List<DocumentInfo>();
|
||||||
protected static void AddToCache(DocumentInfo documentInfo)
|
protected static void AddToCache(DocumentInfo documentInfo)
|
||||||
{
|
{
|
||||||
if (!_CacheList.Contains(documentInfo)) _CacheList.Add(documentInfo); // In AddToCache
|
if (!_CacheList.Contains(documentInfo)) _CacheList.Add(documentInfo); // In AddToCache
|
||||||
}
|
}
|
||||||
protected static void RemoveFromCache(DocumentInfo documentInfo)
|
protected static void RemoveFromCache(DocumentInfo documentInfo)
|
||||||
{
|
{
|
||||||
while (_CacheList.Contains(documentInfo)) _CacheList.Remove(documentInfo); // In RemoveFromCache
|
while (_CacheList.Contains(documentInfo)) _CacheList.Remove(documentInfo); // In RemoveFromCache
|
||||||
}
|
}
|
||||||
private static Dictionary<string, List<DocumentInfo>> _CacheByPrimaryKey = new Dictionary<string, List<DocumentInfo>>();
|
private static Dictionary<string, List<DocumentInfo>> _CacheByPrimaryKey = new Dictionary<string, List<DocumentInfo>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
while (_CacheList.Count > 0) // Move DocumentInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
while (_CacheList.Count > 0) // Move DocumentInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
||||||
{
|
{
|
||||||
DocumentInfo tmp = _CacheList[0]; // Get the first DocumentInfo
|
DocumentInfo tmp = _CacheList[0]; // Get the first DocumentInfo
|
||||||
string pKey = tmp.DocID.ToString();
|
string pKey = tmp.DocID.ToString();
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
||||||
{
|
{
|
||||||
_CacheByPrimaryKey[pKey] = new List<DocumentInfo>(); // Add new list for PrimaryKey
|
_CacheByPrimaryKey[pKey] = new List<DocumentInfo>(); // Add new list for PrimaryKey
|
||||||
}
|
}
|
||||||
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
||||||
_CacheList.RemoveAt(0); // Remove the first DocumentInfo
|
_CacheList.RemoveAt(0); // Remove the first DocumentInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
internal static void AddList(DocumentInfoList lst)
|
internal static void AddList(DocumentInfoList lst)
|
||||||
{
|
{
|
||||||
foreach (DocumentInfo item in lst) AddToCache(item);
|
foreach (DocumentInfo item in lst) AddToCache(item);
|
||||||
}
|
}
|
||||||
protected static DocumentInfo GetCachedByPrimaryKey(int docID)
|
protected static DocumentInfo GetCachedByPrimaryKey(int docID)
|
||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = docID.ToString();
|
string key = docID.ToString();
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Business Methods
|
#region Business Methods
|
||||||
private string _ErrorMessage = string.Empty;
|
private string _ErrorMessage = string.Empty;
|
||||||
public string ErrorMessage
|
public string ErrorMessage
|
||||||
{
|
{
|
||||||
get { return _ErrorMessage; }
|
get { return _ErrorMessage; }
|
||||||
}
|
}
|
||||||
protected Document _Editable;
|
protected Document _Editable;
|
||||||
private IVEHasBrokenRules HasBrokenRules
|
private IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
IVEHasBrokenRules hasBrokenRules = null;
|
IVEHasBrokenRules hasBrokenRules = null;
|
||||||
if (_Editable != null)
|
if (_Editable != null)
|
||||||
hasBrokenRules = _Editable.HasBrokenRules;
|
hasBrokenRules = _Editable.HasBrokenRules;
|
||||||
return hasBrokenRules;
|
return hasBrokenRules;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private int _DocID;
|
private int _DocID;
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
public int DocID
|
public int DocID
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("DocID", true);
|
return _DocID;
|
||||||
return _DocID;
|
}
|
||||||
}
|
}
|
||||||
}
|
private string _LibTitle = string.Empty;
|
||||||
private string _LibTitle = string.Empty;
|
public string LibTitle
|
||||||
public string LibTitle
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
get
|
||||||
get
|
{
|
||||||
{
|
return _LibTitle;
|
||||||
CanReadProperty("LibTitle", true);
|
}
|
||||||
return _LibTitle;
|
}
|
||||||
}
|
private byte[] _DocContent;
|
||||||
}
|
/// <summary>
|
||||||
private byte[] _DocContent;
|
/// Actual content of a Word Document (RTF, DOC or XML Format)
|
||||||
/// <summary>
|
/// </summary>
|
||||||
/// Actual content of a Word Document (RTF, DOC or XML Format)
|
public byte[] DocContent
|
||||||
/// </summary>
|
{
|
||||||
public byte[] DocContent
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
return _DocContent;
|
||||||
{
|
}
|
||||||
CanReadProperty("DocContent", true);
|
}
|
||||||
return _DocContent;
|
private string _DocAscii = string.Empty;
|
||||||
}
|
/// <summary>
|
||||||
}
|
/// Used for searching
|
||||||
private string _DocAscii = string.Empty;
|
/// </summary>
|
||||||
/// <summary>
|
public string DocAscii
|
||||||
/// Used for searching
|
{
|
||||||
/// </summary>
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
public string DocAscii
|
get
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
return _DocAscii;
|
||||||
get
|
}
|
||||||
{
|
}
|
||||||
CanReadProperty("DocAscii", true);
|
private string _Config = string.Empty;
|
||||||
return _DocAscii;
|
public string Config
|
||||||
}
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
private string _Config = string.Empty;
|
get
|
||||||
public string Config
|
{
|
||||||
{
|
return _Config;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
}
|
||||||
{
|
private DateTime _DTS = new DateTime();
|
||||||
CanReadProperty("Config", true);
|
public DateTime DTS
|
||||||
return _Config;
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
private DateTime _DTS = new DateTime();
|
{
|
||||||
public DateTime DTS
|
return _DTS;
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
private string _UserID = string.Empty;
|
||||||
{
|
public string UserID
|
||||||
CanReadProperty("DTS", true);
|
{
|
||||||
return _DTS;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
}
|
{
|
||||||
private string _UserID = string.Empty;
|
return _UserID;
|
||||||
public string UserID
|
}
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
private string _FileExtension = string.Empty;
|
||||||
get
|
public string FileExtension
|
||||||
{
|
{
|
||||||
CanReadProperty("UserID", true);
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
return _UserID;
|
get
|
||||||
}
|
{
|
||||||
}
|
return _FileExtension;
|
||||||
private string _FileExtension = string.Empty;
|
}
|
||||||
public string FileExtension
|
}
|
||||||
{
|
private int _DocumentDROUsageCount = 0;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
/// <summary>
|
||||||
get
|
/// Count of DocumentDROUsages for this Document
|
||||||
{
|
/// </summary>
|
||||||
CanReadProperty("FileExtension", true);
|
public int DocumentDROUsageCount
|
||||||
return _FileExtension;
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
private int _DocumentDROUsageCount = 0;
|
{
|
||||||
/// <summary>
|
if (_DocumentDROUsageCount < 0)
|
||||||
/// Count of DocumentDROUsages for this Document
|
_DocumentDROUsageCount = DocumentDROUsages.Count;
|
||||||
/// </summary>
|
return _DocumentDROUsageCount;
|
||||||
public int DocumentDROUsageCount
|
}
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
private DROUsageInfoList _DocumentDROUsages = null;
|
||||||
get
|
[TypeConverter(typeof(DROUsageInfoListConverter))]
|
||||||
{
|
public DROUsageInfoList DocumentDROUsages
|
||||||
CanReadProperty("DocumentDROUsageCount", true);
|
{
|
||||||
if (_DocumentDROUsageCount < 0)
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
_DocumentDROUsageCount = DocumentDROUsages.Count;
|
get
|
||||||
return _DocumentDROUsageCount;
|
{
|
||||||
}
|
if (_DocumentDROUsageCount < 0 || (_DocumentDROUsageCount > 0 && _DocumentDROUsages == null))
|
||||||
}
|
_DocumentDROUsages = DROUsageInfoList.GetByDocID(_DocID);
|
||||||
private DROUsageInfoList _DocumentDROUsages = null;
|
if (_DocumentDROUsageCount < 0)
|
||||||
[TypeConverter(typeof(DROUsageInfoListConverter))]
|
_DocumentDROUsageCount = _DocumentDROUsages.Count;
|
||||||
public DROUsageInfoList DocumentDROUsages
|
return _DocumentDROUsages;
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
public void RefreshDocumentDROUsages()
|
||||||
{
|
{
|
||||||
CanReadProperty("DocumentDROUsages", true);
|
_DocumentDROUsageCount = -1;
|
||||||
if (_DocumentDROUsageCount < 0 || (_DocumentDROUsageCount > 0 && _DocumentDROUsages == null))
|
ConvertListToDictionary();
|
||||||
_DocumentDROUsages = DROUsageInfoList.GetByDocID(_DocID);
|
if (_CacheByPrimaryKey.ContainsKey(_DocID.ToString()))
|
||||||
if (_DocumentDROUsageCount < 0)
|
foreach (DocumentInfo tmp in _CacheByPrimaryKey[_DocID.ToString()])
|
||||||
_DocumentDROUsageCount = _DocumentDROUsages.Count;
|
tmp._DocumentDROUsageCount = -1; // This will cause the data to be requeried
|
||||||
return _DocumentDROUsages;
|
}
|
||||||
}
|
private int _DocumentEntryCount = 0;
|
||||||
}
|
/// <summary>
|
||||||
public void RefreshDocumentDROUsages()
|
/// Count of DocumentEntries for this Document
|
||||||
{
|
/// </summary>
|
||||||
_DocumentDROUsageCount = -1;
|
public int DocumentEntryCount
|
||||||
ConvertListToDictionary();
|
{
|
||||||
if (_CacheByPrimaryKey.ContainsKey(_DocID.ToString()))
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
foreach (DocumentInfo tmp in _CacheByPrimaryKey[_DocID.ToString()])
|
get
|
||||||
tmp._DocumentDROUsageCount = -1; // This will cause the data to be requeried
|
{
|
||||||
}
|
if (_DocumentEntryCount < 0)
|
||||||
private int _DocumentEntryCount = 0;
|
_DocumentEntryCount = DocumentEntries.Count;
|
||||||
/// <summary>
|
return _DocumentEntryCount;
|
||||||
/// Count of DocumentEntries for this Document
|
}
|
||||||
/// </summary>
|
}
|
||||||
public int DocumentEntryCount
|
private EntryInfoList _DocumentEntries = null;
|
||||||
{
|
[TypeConverter(typeof(EntryInfoListConverter))]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
public EntryInfoList DocumentEntries
|
||||||
get
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
CanReadProperty("DocumentEntryCount", true);
|
get
|
||||||
if (_DocumentEntryCount < 0)
|
{
|
||||||
_DocumentEntryCount = DocumentEntries.Count;
|
if (_DocumentEntryCount < 0 || (_DocumentEntryCount > 0 && _DocumentEntries == null))
|
||||||
return _DocumentEntryCount;
|
_DocumentEntries = EntryInfoList.GetByDocID(_DocID);
|
||||||
}
|
if (_DocumentEntryCount < 0)
|
||||||
}
|
_DocumentEntryCount = _DocumentEntries.Count;
|
||||||
private EntryInfoList _DocumentEntries = null;
|
return _DocumentEntries;
|
||||||
[TypeConverter(typeof(EntryInfoListConverter))]
|
}
|
||||||
public EntryInfoList DocumentEntries
|
}
|
||||||
{
|
public void RefreshDocumentEntries()
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
_DocumentEntryCount = -1;
|
||||||
{
|
ConvertListToDictionary();
|
||||||
CanReadProperty("DocumentEntries", true);
|
if (_CacheByPrimaryKey.ContainsKey(_DocID.ToString()))
|
||||||
if (_DocumentEntryCount < 0 || (_DocumentEntryCount > 0 && _DocumentEntries == null))
|
foreach (DocumentInfo tmp in _CacheByPrimaryKey[_DocID.ToString()])
|
||||||
_DocumentEntries = EntryInfoList.GetByDocID(_DocID);
|
tmp._DocumentEntryCount = -1; // This will cause the data to be requeried
|
||||||
if (_DocumentEntryCount < 0)
|
}
|
||||||
_DocumentEntryCount = _DocumentEntries.Count;
|
private int _DocumentPdfCount = 0;
|
||||||
return _DocumentEntries;
|
/// <summary>
|
||||||
}
|
/// Count of DocumentPdfs for this Document
|
||||||
}
|
/// </summary>
|
||||||
public void RefreshDocumentEntries()
|
public int DocumentPdfCount
|
||||||
{
|
{
|
||||||
_DocumentEntryCount = -1;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
ConvertListToDictionary();
|
get
|
||||||
if (_CacheByPrimaryKey.ContainsKey(_DocID.ToString()))
|
{
|
||||||
foreach (DocumentInfo tmp in _CacheByPrimaryKey[_DocID.ToString()])
|
if (_DocumentPdfCount < 0)
|
||||||
tmp._DocumentEntryCount = -1; // This will cause the data to be requeried
|
_DocumentPdfCount = DocumentPdfs.Count;
|
||||||
}
|
return _DocumentPdfCount;
|
||||||
private int _DocumentPdfCount = 0;
|
}
|
||||||
/// <summary>
|
}
|
||||||
/// Count of DocumentPdfs for this Document
|
private PdfInfoList _DocumentPdfs = null;
|
||||||
/// </summary>
|
[TypeConverter(typeof(PdfInfoListConverter))]
|
||||||
public int DocumentPdfCount
|
public PdfInfoList DocumentPdfs
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("DocumentPdfCount", true);
|
if (_DocumentPdfCount < 0 || (_DocumentPdfCount > 0 && _DocumentPdfs == null))
|
||||||
if (_DocumentPdfCount < 0)
|
_DocumentPdfs = PdfInfoList.GetByDocID(_DocID);
|
||||||
_DocumentPdfCount = DocumentPdfs.Count;
|
if (_DocumentPdfCount < 0)
|
||||||
return _DocumentPdfCount;
|
_DocumentPdfCount = _DocumentPdfs.Count;
|
||||||
}
|
return _DocumentPdfs;
|
||||||
}
|
}
|
||||||
private PdfInfoList _DocumentPdfs = null;
|
}
|
||||||
[TypeConverter(typeof(PdfInfoListConverter))]
|
public void RefreshDocumentPdfs()
|
||||||
public PdfInfoList DocumentPdfs
|
{
|
||||||
{
|
_DocumentPdfCount = -1;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
ConvertListToDictionary();
|
||||||
get
|
if (_CacheByPrimaryKey.ContainsKey(_DocID.ToString()))
|
||||||
{
|
foreach (DocumentInfo tmp in _CacheByPrimaryKey[_DocID.ToString()])
|
||||||
CanReadProperty("DocumentPdfs", true);
|
tmp._DocumentPdfCount = -1; // This will cause the data to be requeried
|
||||||
if (_DocumentPdfCount < 0 || (_DocumentPdfCount > 0 && _DocumentPdfs == null))
|
}
|
||||||
_DocumentPdfs = PdfInfoList.GetByDocID(_DocID);
|
// CSLATODO: Replace base DocumentInfo.ToString function as necessary
|
||||||
if (_DocumentPdfCount < 0)
|
/// <summary>
|
||||||
_DocumentPdfCount = _DocumentPdfs.Count;
|
/// Overrides Base ToString
|
||||||
return _DocumentPdfs;
|
/// </summary>
|
||||||
}
|
/// <returns>A string representation of current DocumentInfo</returns>
|
||||||
}
|
//public override string ToString()
|
||||||
public void RefreshDocumentPdfs()
|
//{
|
||||||
{
|
// return base.ToString();
|
||||||
_DocumentPdfCount = -1;
|
//}
|
||||||
ConvertListToDictionary();
|
// CSLATODO: Check DocumentInfo.GetIdValue to assure that the ID returned is unique
|
||||||
if (_CacheByPrimaryKey.ContainsKey(_DocID.ToString()))
|
/// <summary>
|
||||||
foreach (DocumentInfo tmp in _CacheByPrimaryKey[_DocID.ToString()])
|
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||||
tmp._DocumentPdfCount = -1; // This will cause the data to be requeried
|
/// </summary>
|
||||||
}
|
/// <returns>A Unique ID for the current DocumentInfo</returns>
|
||||||
// CSLATODO: Replace base DocumentInfo.ToString function as necessary
|
protected override object GetIdValue()
|
||||||
/// <summary>
|
{
|
||||||
/// Overrides Base ToString
|
return MyDocumentInfoUnique; // Absolutely Unique ID
|
||||||
/// </summary>
|
}
|
||||||
/// <returns>A string representation of current DocumentInfo</returns>
|
#endregion
|
||||||
//public override string ToString()
|
#region Factory Methods
|
||||||
//{
|
private static int _DocumentInfoUnique = 0;
|
||||||
// return base.ToString();
|
private static int DocumentInfoUnique
|
||||||
//}
|
{ get { return ++_DocumentInfoUnique; } }
|
||||||
// CSLATODO: Check DocumentInfo.GetIdValue to assure that the ID returned is unique
|
private int _MyDocumentInfoUnique = DocumentInfoUnique;
|
||||||
/// <summary>
|
public int MyDocumentInfoUnique // Absolutely Unique ID - Info
|
||||||
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
{ get { return _MyDocumentInfoUnique; } }
|
||||||
/// </summary>
|
protected DocumentInfo()
|
||||||
/// <returns>A Unique ID for the current DocumentInfo</returns>
|
{/* require use of factory methods */
|
||||||
protected override object GetIdValue()
|
AddToCache(this);
|
||||||
{
|
}
|
||||||
return MyDocumentInfoUnique; // Absolutely Unique ID
|
private bool _Disposed = false;
|
||||||
}
|
private static int _CountCreated = 0;
|
||||||
#endregion
|
private static int _CountDisposed = 0;
|
||||||
#region Factory Methods
|
private static int _CountFinalized = 0;
|
||||||
private static int _DocumentInfoUnique = 0;
|
private static int IncrementCountCreated
|
||||||
private static int DocumentInfoUnique
|
{ get { return ++_CountCreated; } }
|
||||||
{ get { return ++_DocumentInfoUnique; } }
|
private int _CountWhenCreated = IncrementCountCreated;
|
||||||
private int _MyDocumentInfoUnique = DocumentInfoUnique;
|
public static int CountCreated
|
||||||
public int MyDocumentInfoUnique // Absolutely Unique ID - Info
|
{ get { return _CountCreated; } }
|
||||||
{ get { return _MyDocumentInfoUnique; } }
|
public static int CountNotDisposed
|
||||||
protected DocumentInfo()
|
{ get { return _CountCreated - _CountDisposed; } }
|
||||||
{/* require use of factory methods */
|
public static int CountNotFinalized
|
||||||
AddToCache(this);
|
{ get { return _CountCreated - _CountFinalized; } }
|
||||||
}
|
~DocumentInfo()
|
||||||
private bool _Disposed = false;
|
{
|
||||||
private static int _CountCreated = 0;
|
_CountFinalized++;
|
||||||
private static int _CountDisposed = 0;
|
}
|
||||||
private static int _CountFinalized = 0;
|
public void Dispose()
|
||||||
private static int IncrementCountCreated
|
{
|
||||||
{ get { return ++_CountCreated; } }
|
if (_Disposed) return;
|
||||||
private int _CountWhenCreated = IncrementCountCreated;
|
_CountDisposed++;
|
||||||
public static int CountCreated
|
_Disposed = true;
|
||||||
{ get { return _CountCreated; } }
|
RemoveFromCache(this);
|
||||||
public static int CountNotDisposed
|
if (!_CacheByPrimaryKey.ContainsKey(DocID.ToString())) return;
|
||||||
{ get { return _CountCreated - _CountDisposed; } }
|
List<DocumentInfo> listDocumentInfo = _CacheByPrimaryKey[DocID.ToString()]; // Get the list of items
|
||||||
public static int CountNotFinalized
|
while (listDocumentInfo.Contains(this)) listDocumentInfo.Remove(this); // Remove the item from the list
|
||||||
{ get { return _CountCreated - _CountFinalized; } }
|
if (listDocumentInfo.Count == 0) // If there are no items left in the list
|
||||||
~DocumentInfo()
|
_CacheByPrimaryKey.Remove(DocID.ToString()); // remove the list
|
||||||
{
|
}
|
||||||
_CountFinalized++;
|
public virtual Document Get()
|
||||||
}
|
{
|
||||||
public void Dispose()
|
return _Editable = Document.Get(_DocID);
|
||||||
{
|
}
|
||||||
if (_Disposed) return;
|
public static void Refresh(Document tmp)
|
||||||
_CountDisposed++;
|
{
|
||||||
_Disposed = true;
|
string key = tmp.DocID.ToString();
|
||||||
RemoveFromCache(this);
|
ConvertListToDictionary();
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(DocID.ToString())) return;
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
List<DocumentInfo> listDocumentInfo = _CacheByPrimaryKey[DocID.ToString()]; // Get the list of items
|
foreach (DocumentInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
while (listDocumentInfo.Contains(this)) listDocumentInfo.Remove(this); // Remove the item from the list
|
tmpInfo.RefreshFields(tmp);
|
||||||
if (listDocumentInfo.Count == 0) // If there are no items left in the list
|
}
|
||||||
_CacheByPrimaryKey.Remove(DocID.ToString()); // remove the list
|
protected virtual void RefreshFields(Document tmp)
|
||||||
}
|
{
|
||||||
public virtual Document Get()
|
_LibTitle = tmp.LibTitle;
|
||||||
{
|
_DocContent = tmp.DocContent;
|
||||||
return _Editable = Document.Get(_DocID);
|
_DocAscii = tmp.DocAscii;
|
||||||
}
|
_Config = tmp.Config;
|
||||||
public static void Refresh(Document tmp)
|
_DTS = tmp.DTS;
|
||||||
{
|
_UserID = tmp.UserID;
|
||||||
string key = tmp.DocID.ToString();
|
_FileExtension = tmp.FileExtension;
|
||||||
ConvertListToDictionary();
|
_DocumentInfoExtension.Refresh(this);
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
OnChange();// raise an event
|
||||||
foreach (DocumentInfo tmpInfo in _CacheByPrimaryKey[key])
|
}
|
||||||
tmpInfo.RefreshFields(tmp);
|
public static DocumentInfo Get(int docID)
|
||||||
}
|
{
|
||||||
protected virtual void RefreshFields(Document tmp)
|
//if (!CanGetObject())
|
||||||
{
|
// throw new System.Security.SecurityException("User not authorized to view a Document");
|
||||||
_LibTitle = tmp.LibTitle;
|
try
|
||||||
_DocContent = tmp.DocContent;
|
{
|
||||||
_DocAscii = tmp.DocAscii;
|
DocumentInfo tmp = GetCachedByPrimaryKey(docID);
|
||||||
_Config = tmp.Config;
|
if (tmp == null)
|
||||||
_DTS = tmp.DTS;
|
{
|
||||||
_UserID = tmp.UserID;
|
tmp = DataPortal.Fetch<DocumentInfo>(new PKCriteria(docID));
|
||||||
_FileExtension = tmp.FileExtension;
|
AddToCache(tmp);
|
||||||
_DocumentInfoExtension.Refresh(this);
|
}
|
||||||
OnChange();// raise an event
|
if (tmp.ErrorMessage == "No Record Found")
|
||||||
}
|
{
|
||||||
public static DocumentInfo Get(int docID)
|
tmp.Dispose(); // Clean-up DocumentInfo
|
||||||
{
|
tmp = null;
|
||||||
//if (!CanGetObject())
|
}
|
||||||
// throw new System.Security.SecurityException("User not authorized to view a Document");
|
return tmp;
|
||||||
try
|
}
|
||||||
{
|
catch (Exception ex)
|
||||||
DocumentInfo tmp = GetCachedByPrimaryKey(docID);
|
{
|
||||||
if (tmp == null)
|
throw new DbCslaException("Error on DocumentInfo.Get", ex);
|
||||||
{
|
}
|
||||||
tmp = DataPortal.Fetch<DocumentInfo>(new PKCriteria(docID));
|
}
|
||||||
AddToCache(tmp);
|
#endregion
|
||||||
}
|
#region Data Access Portal
|
||||||
if (tmp.ErrorMessage == "No Record Found")
|
internal DocumentInfo(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
tmp.Dispose(); // Clean-up DocumentInfo
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocumentInfo.Constructor", GetHashCode());
|
||||||
tmp = null;
|
try
|
||||||
}
|
{
|
||||||
return tmp;
|
ReadData(dr);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
throw new DbCslaException("Error on DocumentInfo.Get", ex);
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocumentInfo.Constructor", ex);
|
||||||
}
|
throw new DbCslaException("DocumentInfo.Constructor", ex);
|
||||||
}
|
}
|
||||||
#endregion
|
}
|
||||||
#region Data Access Portal
|
[Serializable()]
|
||||||
internal DocumentInfo(SafeDataReader dr)
|
protected class PKCriteria
|
||||||
{
|
{
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocumentInfo.Constructor", GetHashCode());
|
private int _DocID;
|
||||||
try
|
public int DocID
|
||||||
{
|
{ get { return _DocID; } }
|
||||||
ReadData(dr);
|
public PKCriteria(int docID)
|
||||||
}
|
{
|
||||||
catch (Exception ex)
|
_DocID = docID;
|
||||||
{
|
}
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocumentInfo.Constructor", ex);
|
}
|
||||||
throw new DbCslaException("DocumentInfo.Constructor", ex);
|
private void ReadData(SafeDataReader dr)
|
||||||
}
|
{
|
||||||
}
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocumentInfo.ReadData", GetHashCode());
|
||||||
[Serializable()]
|
try
|
||||||
protected class PKCriteria
|
{
|
||||||
{
|
_DocID = dr.GetInt32("DocID");
|
||||||
private int _DocID;
|
_LibTitle = dr.GetString("LibTitle");
|
||||||
public int DocID
|
_DocContent = (byte[])dr.GetValue("DocContent");
|
||||||
{ get { return _DocID; } }
|
_DocAscii = dr.GetString("DocAscii");
|
||||||
public PKCriteria(int docID)
|
_Config = dr.GetString("Config");
|
||||||
{
|
_DTS = dr.GetDateTime("DTS");
|
||||||
_DocID = docID;
|
_UserID = dr.GetString("UserID");
|
||||||
}
|
_FileExtension = dr.GetString("FileExtension");
|
||||||
}
|
_DocumentDROUsageCount = dr.GetInt32("DROUsageCount");
|
||||||
private void ReadData(SafeDataReader dr)
|
_DocumentEntryCount = dr.GetInt32("EntryCount");
|
||||||
{
|
_DocumentPdfCount = dr.GetInt32("PdfCount");
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocumentInfo.ReadData", GetHashCode());
|
}
|
||||||
try
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_DocID = dr.GetInt32("DocID");
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocumentInfo.ReadData", ex);
|
||||||
_LibTitle = dr.GetString("LibTitle");
|
_ErrorMessage = ex.Message;
|
||||||
_DocContent = (byte[])dr.GetValue("DocContent");
|
throw new DbCslaException("DocumentInfo.ReadData", ex);
|
||||||
_DocAscii = dr.GetString("DocAscii");
|
}
|
||||||
_Config = dr.GetString("Config");
|
}
|
||||||
_DTS = dr.GetDateTime("DTS");
|
private void DataPortal_Fetch(PKCriteria criteria)
|
||||||
_UserID = dr.GetString("UserID");
|
{
|
||||||
_FileExtension = dr.GetString("FileExtension");
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocumentInfo.DataPortal_Fetch", GetHashCode());
|
||||||
_DocumentDROUsageCount = dr.GetInt32("DROUsageCount");
|
try
|
||||||
_DocumentEntryCount = dr.GetInt32("EntryCount");
|
{
|
||||||
_DocumentPdfCount = dr.GetInt32("PdfCount");
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
}
|
{
|
||||||
catch (Exception ex)
|
ApplicationContext.LocalContext["cn"] = cn;
|
||||||
{
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocumentInfo.ReadData", ex);
|
{
|
||||||
_ErrorMessage = ex.Message;
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
throw new DbCslaException("DocumentInfo.ReadData", ex);
|
cm.CommandText = "getDocument";
|
||||||
}
|
cm.Parameters.AddWithValue("@DocID", criteria.DocID);
|
||||||
}
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
private void DataPortal_Fetch(PKCriteria criteria)
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
{
|
{
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocumentInfo.DataPortal_Fetch", GetHashCode());
|
if (!dr.Read())
|
||||||
try
|
{
|
||||||
{
|
_ErrorMessage = "No Record Found";
|
||||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
return;
|
||||||
{
|
}
|
||||||
ApplicationContext.LocalContext["cn"] = cn;
|
ReadData(dr);
|
||||||
using (SqlCommand cm = cn.CreateCommand())
|
}
|
||||||
{
|
}
|
||||||
cm.CommandType = CommandType.StoredProcedure;
|
// removing of item only needed for local data portal
|
||||||
cm.CommandText = "getDocument";
|
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
||||||
cm.Parameters.AddWithValue("@DocID", criteria.DocID);
|
ApplicationContext.LocalContext.Remove("cn");
|
||||||
cm.CommandTimeout = Database.DefaultTimeout;
|
}
|
||||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
}
|
||||||
{
|
catch (Exception ex)
|
||||||
if (!dr.Read())
|
{
|
||||||
{
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocumentInfo.DataPortal_Fetch", ex);
|
||||||
_ErrorMessage = "No Record Found";
|
_ErrorMessage = ex.Message;
|
||||||
return;
|
throw new DbCslaException("DocumentInfo.DataPortal_Fetch", ex);
|
||||||
}
|
}
|
||||||
ReadData(dr);
|
}
|
||||||
}
|
#endregion
|
||||||
}
|
// Standard Refresh
|
||||||
// removing of item only needed for local data portal
|
#region extension
|
||||||
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
DocumentInfoExtension _DocumentInfoExtension = new DocumentInfoExtension();
|
||||||
ApplicationContext.LocalContext.Remove("cn");
|
[Serializable()]
|
||||||
}
|
partial class DocumentInfoExtension : extensionBase { }
|
||||||
}
|
[Serializable()]
|
||||||
catch (Exception ex)
|
class extensionBase
|
||||||
{
|
{
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocumentInfo.DataPortal_Fetch", ex);
|
// Default Refresh
|
||||||
_ErrorMessage = ex.Message;
|
public virtual void Refresh(DocumentInfo tmp) { }
|
||||||
throw new DbCslaException("DocumentInfo.DataPortal_Fetch", ex);
|
}
|
||||||
}
|
#endregion
|
||||||
}
|
} // Class
|
||||||
#endregion
|
#region Converter
|
||||||
// Standard Refresh
|
internal class DocumentInfoConverter : ExpandableObjectConverter
|
||||||
#region extension
|
{
|
||||||
DocumentInfoExtension _DocumentInfoExtension = new DocumentInfoExtension();
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
[Serializable()]
|
{
|
||||||
partial class DocumentInfoExtension : extensionBase { }
|
if (destType == typeof(string) && value is DocumentInfo)
|
||||||
[Serializable()]
|
{
|
||||||
class extensionBase
|
// Return the ToString value
|
||||||
{
|
return ((DocumentInfo)value).ToString();
|
||||||
// Default Refresh
|
}
|
||||||
public virtual void Refresh(DocumentInfo tmp) { }
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
}
|
}
|
||||||
#endregion
|
}
|
||||||
} // Class
|
#endregion
|
||||||
#region Converter
|
|
||||||
internal class DocumentInfoConverter : ExpandableObjectConverter
|
|
||||||
{
|
|
||||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
|
||||||
{
|
|
||||||
if (destType == typeof(string) && value is DocumentInfo)
|
|
||||||
{
|
|
||||||
// Return the ToString value
|
|
||||||
return ((DocumentInfo)value).ToString();
|
|
||||||
}
|
|
||||||
return base.ConvertTo(context, culture, value, destType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
@ -20,471 +20,458 @@ using System.Collections.Generic;
|
|||||||
using Csla.Validation;
|
using Csla.Validation;
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// DocumentPdf Generated by MyGeneration using the CSLA Object Mapping template
|
/// DocumentPdf Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
[TypeConverter(typeof(DocumentPdfConverter))]
|
[TypeConverter(typeof(DocumentPdfConverter))]
|
||||||
public partial class DocumentPdf : BusinessBase<DocumentPdf>, IVEHasBrokenRules, IDisposable
|
public partial class DocumentPdf : BusinessBase<DocumentPdf>, IVEHasBrokenRules, IDisposable
|
||||||
{
|
{
|
||||||
#region Log4Net
|
#region Log4Net
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#endregion
|
#endregion
|
||||||
#region Business Methods
|
#region Business Methods
|
||||||
private string _ErrorMessage = string.Empty;
|
private string _ErrorMessage = string.Empty;
|
||||||
public string ErrorMessage
|
public string ErrorMessage
|
||||||
{
|
{
|
||||||
get { return _ErrorMessage; }
|
get { return _ErrorMessage; }
|
||||||
}
|
}
|
||||||
private int _DebugStatus;
|
private int _DebugStatus;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// > 0 for Debug
|
/// > 0 for Debug
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
public int DebugStatus
|
public int DebugStatus
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("DebugStatus", true);
|
return _DebugStatus;
|
||||||
return _DebugStatus;
|
}
|
||||||
}
|
}
|
||||||
}
|
private int _TopRow;
|
||||||
private int _TopRow;
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
public int TopRow
|
||||||
public int TopRow
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
get
|
||||||
get
|
{
|
||||||
{
|
return _TopRow;
|
||||||
CanReadProperty("TopRow", true);
|
}
|
||||||
return _TopRow;
|
}
|
||||||
}
|
private int _PageLength;
|
||||||
}
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
private int _PageLength;
|
public int PageLength
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
{
|
||||||
public int PageLength
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
return _PageLength;
|
||||||
{
|
}
|
||||||
CanReadProperty("PageLength", true);
|
}
|
||||||
return _PageLength;
|
private int _LeftMargin;
|
||||||
}
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
}
|
public int LeftMargin
|
||||||
private int _LeftMargin;
|
{
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
public int LeftMargin
|
get
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
return _LeftMargin;
|
||||||
get
|
}
|
||||||
{
|
}
|
||||||
CanReadProperty("LeftMargin", true);
|
private int _PageWidth;
|
||||||
return _LeftMargin;
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
}
|
public int PageWidth
|
||||||
}
|
{
|
||||||
private int _PageWidth;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
get
|
||||||
public int PageWidth
|
{
|
||||||
{
|
return _PageWidth;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
}
|
||||||
{
|
private double _PageCount;
|
||||||
CanReadProperty("PageWidth", true);
|
/// <summary>
|
||||||
return _PageWidth;
|
/// Count of whole and partial pages
|
||||||
}
|
/// </summary>
|
||||||
}
|
public double PageCount
|
||||||
private double _PageCount;
|
{
|
||||||
/// <summary>
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
/// Count of whole and partial pages
|
get
|
||||||
/// </summary>
|
{
|
||||||
public double PageCount
|
return _PageCount;
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
set
|
||||||
{
|
{
|
||||||
CanReadProperty("PageCount", true);
|
if (_PageCount != value)
|
||||||
return _PageCount;
|
{
|
||||||
}
|
_PageCount = value;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
PropertyHasChanged();
|
||||||
set
|
}
|
||||||
{
|
}
|
||||||
CanWriteProperty("PageCount", true);
|
}
|
||||||
if (_PageCount != value)
|
private byte[] _DocPdf;
|
||||||
{
|
public byte[] DocPdf
|
||||||
_PageCount = value;
|
{
|
||||||
PropertyHasChanged();
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
}
|
{
|
||||||
}
|
return _DocPdf;
|
||||||
private byte[] _DocPdf;
|
}
|
||||||
public byte[] DocPdf
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
set
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
if (_DocPdf != value)
|
||||||
{
|
{
|
||||||
CanReadProperty("DocPdf", true);
|
_DocPdf = value;
|
||||||
return _DocPdf;
|
PropertyHasChanged();
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
set
|
}
|
||||||
{
|
private DateTime _DTS = new DateTime();
|
||||||
CanWriteProperty("DocPdf", true);
|
public DateTime DTS
|
||||||
if (_DocPdf != value)
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
_DocPdf = value;
|
get
|
||||||
PropertyHasChanged();
|
{
|
||||||
}
|
return _DTS;
|
||||||
}
|
}
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
private DateTime _DTS = new DateTime();
|
set
|
||||||
public DateTime DTS
|
{
|
||||||
{
|
if (_DTS != value)
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
_DTS = value;
|
||||||
{
|
PropertyHasChanged();
|
||||||
CanReadProperty("DTS", true);
|
}
|
||||||
return _DTS;
|
}
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
private string _UserID = string.Empty;
|
||||||
set
|
public string UserID
|
||||||
{
|
{
|
||||||
CanWriteProperty("DTS", true);
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
if (_DTS != value)
|
get
|
||||||
{
|
{
|
||||||
_DTS = value;
|
return _UserID;
|
||||||
PropertyHasChanged();
|
}
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
set
|
||||||
}
|
{
|
||||||
private string _UserID = string.Empty;
|
if (value == null) value = string.Empty;
|
||||||
public string UserID
|
if (_UserID != value)
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
_UserID = value;
|
||||||
get
|
PropertyHasChanged();
|
||||||
{
|
}
|
||||||
CanReadProperty("UserID", true);
|
}
|
||||||
return _UserID;
|
}
|
||||||
}
|
private byte[] _LastChanged = new byte[8];//timestamp
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
// CSLATODO: Check DocumentPdf.GetIdValue to assure that the ID returned is unique
|
||||||
set
|
/// <summary>
|
||||||
{
|
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||||
CanWriteProperty("UserID", true);
|
/// </summary>
|
||||||
if (value == null) value = string.Empty;
|
/// <returns>A Unique ID for the current DocumentPdf</returns>
|
||||||
if (_UserID != value)
|
protected override object GetIdValue()
|
||||||
{
|
{
|
||||||
_UserID = value;
|
return MyDocumentPdfUnique; // Absolutely Unique ID
|
||||||
PropertyHasChanged();
|
}
|
||||||
}
|
// CSLATODO: Replace base DocumentPdf.ToString function as necessary
|
||||||
}
|
/// <summary>
|
||||||
}
|
/// Overrides Base ToString
|
||||||
private byte[] _LastChanged = new byte[8];//timestamp
|
/// </summary>
|
||||||
// CSLATODO: Check DocumentPdf.GetIdValue to assure that the ID returned is unique
|
/// <returns>A string representation of current DocumentPdf</returns>
|
||||||
/// <summary>
|
//public override string ToString()
|
||||||
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
//{
|
||||||
/// </summary>
|
// return base.ToString();
|
||||||
/// <returns>A Unique ID for the current DocumentPdf</returns>
|
//}
|
||||||
protected override object GetIdValue()
|
public override bool IsDirty
|
||||||
{
|
{
|
||||||
return MyDocumentPdfUnique; // Absolutely Unique ID
|
get { return base.IsDirty; }
|
||||||
}
|
}
|
||||||
// CSLATODO: Replace base DocumentPdf.ToString function as necessary
|
public bool IsDirtyList(List<object> list)
|
||||||
/// <summary>
|
{
|
||||||
/// Overrides Base ToString
|
return base.IsDirty;
|
||||||
/// </summary>
|
}
|
||||||
/// <returns>A string representation of current DocumentPdf</returns>
|
public override bool IsValid
|
||||||
//public override string ToString()
|
{
|
||||||
//{
|
get { return (IsNew && !IsDirty) ? true : base.IsValid; }
|
||||||
// return base.ToString();
|
}
|
||||||
//}
|
public bool IsValidList(List<object> list)
|
||||||
public override bool IsDirty
|
{
|
||||||
{
|
return (IsNew && !IsDirty) ? true : base.IsValid;
|
||||||
get { return base.IsDirty; }
|
}
|
||||||
}
|
#endregion
|
||||||
public bool IsDirtyList(List<object> list)
|
#region ValidationRules
|
||||||
{
|
[NonSerialized]
|
||||||
return base.IsDirty;
|
private bool _CheckingBrokenRules = false;
|
||||||
}
|
public IVEHasBrokenRules HasBrokenRules
|
||||||
public override bool IsValid
|
{
|
||||||
{
|
get
|
||||||
get { return (IsNew && !IsDirty) ? true : base.IsValid; }
|
{
|
||||||
}
|
if (_CheckingBrokenRules) return null;
|
||||||
public bool IsValidList(List<object> list)
|
if (BrokenRulesCollection.Count > 0) return this;
|
||||||
{
|
try
|
||||||
return (IsNew && !IsDirty) ? true : base.IsValid;
|
{
|
||||||
}
|
_CheckingBrokenRules = true;
|
||||||
#endregion
|
IVEHasBrokenRules hasBrokenRules = null;
|
||||||
#region ValidationRules
|
return hasBrokenRules;
|
||||||
[NonSerialized]
|
}
|
||||||
private bool _CheckingBrokenRules = false;
|
finally
|
||||||
public IVEHasBrokenRules HasBrokenRules
|
{
|
||||||
{
|
_CheckingBrokenRules = false;
|
||||||
get
|
}
|
||||||
{
|
}
|
||||||
if (_CheckingBrokenRules) return null;
|
}
|
||||||
if (BrokenRulesCollection.Count > 0) return this;
|
public BrokenRulesCollection BrokenRules
|
||||||
try
|
{
|
||||||
{
|
get
|
||||||
_CheckingBrokenRules = true;
|
{
|
||||||
IVEHasBrokenRules hasBrokenRules = null;
|
IVEHasBrokenRules hasBrokenRules = HasBrokenRules;
|
||||||
return hasBrokenRules;
|
if (this.Equals(hasBrokenRules)) return BrokenRulesCollection;
|
||||||
}
|
return (hasBrokenRules != null ? hasBrokenRules.BrokenRules : null);
|
||||||
finally
|
}
|
||||||
{
|
}
|
||||||
_CheckingBrokenRules = false;
|
protected override void AddBusinessRules()
|
||||||
}
|
{
|
||||||
}
|
ValidationRules.AddRule(
|
||||||
}
|
Csla.Validation.CommonRules.StringRequired, "UserID");
|
||||||
public BrokenRulesCollection BrokenRules
|
ValidationRules.AddRule(
|
||||||
{
|
Csla.Validation.CommonRules.StringMaxLength,
|
||||||
get
|
new Csla.Validation.CommonRules.MaxLengthRuleArgs("UserID", 100));
|
||||||
{
|
// CSLATODO: Add other validation rules
|
||||||
IVEHasBrokenRules hasBrokenRules = HasBrokenRules;
|
}
|
||||||
if (this.Equals(hasBrokenRules)) return BrokenRulesCollection;
|
// Sample data comparison validation rule
|
||||||
return (hasBrokenRules != null ? hasBrokenRules.BrokenRules : null);
|
//private bool StartDateGTEndDate(object target, Csla.Validation.RuleArgs e)
|
||||||
}
|
//{
|
||||||
}
|
// if (_started > _ended)
|
||||||
protected override void AddBusinessRules()
|
// {
|
||||||
{
|
// e.Description = "Start date can't be after end date";
|
||||||
ValidationRules.AddRule(
|
// return false;
|
||||||
Csla.Validation.CommonRules.StringRequired, "UserID");
|
// }
|
||||||
ValidationRules.AddRule(
|
// else
|
||||||
Csla.Validation.CommonRules.StringMaxLength,
|
// return true;
|
||||||
new Csla.Validation.CommonRules.MaxLengthRuleArgs("UserID", 100));
|
//}
|
||||||
// CSLATODO: Add other validation rules
|
#endregion
|
||||||
}
|
#region Authorization Rules
|
||||||
// Sample data comparison validation rule
|
protected override void AddAuthorizationRules()
|
||||||
//private bool StartDateGTEndDate(object target, Csla.Validation.RuleArgs e)
|
{
|
||||||
//{
|
//CSLATODO: Who can read/write which fields
|
||||||
// if (_started > _ended)
|
//AuthorizationRules.AllowRead(DebugStatus, "<Role(s)>");
|
||||||
// {
|
//AuthorizationRules.AllowRead(TopRow, "<Role(s)>");
|
||||||
// e.Description = "Start date can't be after end date";
|
//AuthorizationRules.AllowRead(PageLength, "<Role(s)>");
|
||||||
// return false;
|
//AuthorizationRules.AllowRead(LeftMargin, "<Role(s)>");
|
||||||
// }
|
//AuthorizationRules.AllowRead(PageWidth, "<Role(s)>");
|
||||||
// else
|
//AuthorizationRules.AllowRead(PageCount, "<Role(s)>");
|
||||||
// return true;
|
//AuthorizationRules.AllowWrite(PageCount, "<Role(s)>");
|
||||||
//}
|
//AuthorizationRules.AllowRead(DocPdf, "<Role(s)>");
|
||||||
#endregion
|
//AuthorizationRules.AllowWrite(DocPdf, "<Role(s)>");
|
||||||
#region Authorization Rules
|
//AuthorizationRules.AllowRead(DTS, "<Role(s)>");
|
||||||
protected override void AddAuthorizationRules()
|
//AuthorizationRules.AllowWrite(DTS, "<Role(s)>");
|
||||||
{
|
//AuthorizationRules.AllowRead(UserID, "<Role(s)>");
|
||||||
//CSLATODO: Who can read/write which fields
|
//AuthorizationRules.AllowWrite(UserID, "<Role(s)>");
|
||||||
//AuthorizationRules.AllowRead(DebugStatus, "<Role(s)>");
|
}
|
||||||
//AuthorizationRules.AllowRead(TopRow, "<Role(s)>");
|
public static bool CanAddObject()
|
||||||
//AuthorizationRules.AllowRead(PageLength, "<Role(s)>");
|
{
|
||||||
//AuthorizationRules.AllowRead(LeftMargin, "<Role(s)>");
|
// CSLATODO: Can Add Authorization
|
||||||
//AuthorizationRules.AllowRead(PageWidth, "<Role(s)>");
|
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
|
||||||
//AuthorizationRules.AllowRead(PageCount, "<Role(s)>");
|
return true;
|
||||||
//AuthorizationRules.AllowWrite(PageCount, "<Role(s)>");
|
}
|
||||||
//AuthorizationRules.AllowRead(DocPdf, "<Role(s)>");
|
public static bool CanGetObject()
|
||||||
//AuthorizationRules.AllowWrite(DocPdf, "<Role(s)>");
|
{
|
||||||
//AuthorizationRules.AllowRead(DTS, "<Role(s)>");
|
// CSLATODO: CanGet Authorization
|
||||||
//AuthorizationRules.AllowWrite(DTS, "<Role(s)>");
|
return true;
|
||||||
//AuthorizationRules.AllowRead(UserID, "<Role(s)>");
|
}
|
||||||
//AuthorizationRules.AllowWrite(UserID, "<Role(s)>");
|
public static bool CanDeleteObject()
|
||||||
}
|
{
|
||||||
public static bool CanAddObject()
|
// CSLATODO: CanDelete Authorization
|
||||||
{
|
//bool result = false;
|
||||||
// CSLATODO: Can Add Authorization
|
//if (Csla.ApplicationContext.User.IsInRole("ProjectManager"))result = true;
|
||||||
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
|
//if (Csla.ApplicationContext.User.IsInRole("Administrator"))result = true;
|
||||||
return true;
|
//return result;
|
||||||
}
|
return true;
|
||||||
public static bool CanGetObject()
|
}
|
||||||
{
|
public static bool CanEditObject()
|
||||||
// CSLATODO: CanGet Authorization
|
{
|
||||||
return true;
|
// CSLATODO: CanEdit Authorization
|
||||||
}
|
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
|
||||||
public static bool CanDeleteObject()
|
return true;
|
||||||
{
|
}
|
||||||
// CSLATODO: CanDelete Authorization
|
#endregion
|
||||||
//bool result = false;
|
#region Factory Methods
|
||||||
//if (Csla.ApplicationContext.User.IsInRole("ProjectManager"))result = true;
|
public int CurrentEditLevel
|
||||||
//if (Csla.ApplicationContext.User.IsInRole("Administrator"))result = true;
|
{ get { return EditLevel; } }
|
||||||
//return result;
|
private static int _DocumentPdfUnique = 0;
|
||||||
return true;
|
private static int DocumentPdfUnique
|
||||||
}
|
{ get { return ++_DocumentPdfUnique; } }
|
||||||
public static bool CanEditObject()
|
private int _MyDocumentPdfUnique = DocumentPdfUnique;
|
||||||
{
|
public int MyDocumentPdfUnique // Absolutely Unique ID - Editable FK
|
||||||
// CSLATODO: CanEdit Authorization
|
{ get { return _MyDocumentPdfUnique; } }
|
||||||
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
|
internal static DocumentPdf New(int debugStatus, int topRow, int pageLength, int leftMargin, int pageWidth, double pageCount)
|
||||||
return true;
|
{
|
||||||
}
|
return new DocumentPdf(debugStatus, topRow, pageLength, leftMargin, pageWidth, pageCount);
|
||||||
#endregion
|
}
|
||||||
#region Factory Methods
|
internal static DocumentPdf Get(SafeDataReader dr)
|
||||||
public int CurrentEditLevel
|
{
|
||||||
{ get { return EditLevel; } }
|
return new DocumentPdf(dr);
|
||||||
private static int _DocumentPdfUnique = 0;
|
}
|
||||||
private static int DocumentPdfUnique
|
public DocumentPdf()
|
||||||
{ get { return ++_DocumentPdfUnique; } }
|
{
|
||||||
private int _MyDocumentPdfUnique = DocumentPdfUnique;
|
MarkAsChild();
|
||||||
public int MyDocumentPdfUnique // Absolutely Unique ID - Editable FK
|
|
||||||
{ get { return _MyDocumentPdfUnique; } }
|
|
||||||
internal static DocumentPdf New(int debugStatus, int topRow, int pageLength, int leftMargin, int pageWidth, double pageCount)
|
|
||||||
{
|
|
||||||
return new DocumentPdf(debugStatus, topRow, pageLength, leftMargin, pageWidth, pageCount);
|
|
||||||
}
|
|
||||||
internal static DocumentPdf Get(SafeDataReader dr)
|
|
||||||
{
|
|
||||||
return new DocumentPdf(dr);
|
|
||||||
}
|
|
||||||
public DocumentPdf()
|
|
||||||
{
|
|
||||||
MarkAsChild();
|
|
||||||
|
|
||||||
_DTS = _DocumentPdfExtension.DefaultDTS;
|
_DTS = _DocumentPdfExtension.DefaultDTS;
|
||||||
_UserID = _DocumentPdfExtension.DefaultUserID;
|
_UserID = _DocumentPdfExtension.DefaultUserID;
|
||||||
ValidationRules.CheckRules();
|
ValidationRules.CheckRules();
|
||||||
}
|
}
|
||||||
private DocumentPdf(int debugStatus, int topRow, int pageLength, int leftMargin, int pageWidth, double pageCount)
|
private DocumentPdf(int debugStatus, int topRow, int pageLength, int leftMargin, int pageWidth, double pageCount)
|
||||||
{
|
{
|
||||||
MarkAsChild();
|
MarkAsChild();
|
||||||
// CSLATODO: Add any initialization & defaults
|
// CSLATODO: Add any initialization & defaults
|
||||||
_DTS = _DocumentPdfExtension.DefaultDTS;
|
_DTS = _DocumentPdfExtension.DefaultDTS;
|
||||||
_UserID = _DocumentPdfExtension.DefaultUserID;
|
_UserID = _DocumentPdfExtension.DefaultUserID;
|
||||||
_DebugStatus = debugStatus;
|
_DebugStatus = debugStatus;
|
||||||
_TopRow = topRow;
|
_TopRow = topRow;
|
||||||
_PageLength = pageLength;
|
_PageLength = pageLength;
|
||||||
_LeftMargin = leftMargin;
|
_LeftMargin = leftMargin;
|
||||||
_PageWidth = pageWidth;
|
_PageWidth = pageWidth;
|
||||||
_PageCount = pageCount;
|
_PageCount = pageCount;
|
||||||
ValidationRules.CheckRules();
|
ValidationRules.CheckRules();
|
||||||
}
|
}
|
||||||
internal DocumentPdf(SafeDataReader dr)
|
internal DocumentPdf(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
MarkAsChild();
|
MarkAsChild();
|
||||||
Fetch(dr);
|
Fetch(dr);
|
||||||
}
|
}
|
||||||
private bool _Disposed = false;
|
private bool _Disposed = false;
|
||||||
private static int _CountCreated = 0;
|
private static int _CountCreated = 0;
|
||||||
private static int _CountDisposed = 0;
|
private static int _CountDisposed = 0;
|
||||||
private static int _CountFinalized = 0;
|
private static int _CountFinalized = 0;
|
||||||
private static int IncrementCountCreated
|
private static int IncrementCountCreated
|
||||||
{ get { return ++_CountCreated; } }
|
{ get { return ++_CountCreated; } }
|
||||||
private int _CountWhenCreated = IncrementCountCreated;
|
private int _CountWhenCreated = IncrementCountCreated;
|
||||||
public static int CountCreated
|
public static int CountCreated
|
||||||
{ get { return _CountCreated; } }
|
{ get { return _CountCreated; } }
|
||||||
public static int CountNotDisposed
|
public static int CountNotDisposed
|
||||||
{ get { return _CountCreated - _CountDisposed; } }
|
{ get { return _CountCreated - _CountDisposed; } }
|
||||||
public static int CountNotFinalized
|
public static int CountNotFinalized
|
||||||
{ get { return _CountCreated - _CountFinalized; } }
|
{ get { return _CountCreated - _CountFinalized; } }
|
||||||
~DocumentPdf()
|
~DocumentPdf()
|
||||||
{
|
{
|
||||||
_CountFinalized++;
|
_CountFinalized++;
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
if (_Disposed) return;
|
if (_Disposed) return;
|
||||||
_CountDisposed++;
|
_CountDisposed++;
|
||||||
_Disposed = true;
|
_Disposed = true;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Data Access Portal
|
#region Data Access Portal
|
||||||
private void Fetch(SafeDataReader dr)
|
private void Fetch(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocumentPdf.FetchDR", GetHashCode());
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocumentPdf.FetchDR", GetHashCode());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_DebugStatus = dr.GetInt32("DebugStatus");
|
_DebugStatus = dr.GetInt32("DebugStatus");
|
||||||
_TopRow = dr.GetInt32("TopRow");
|
_TopRow = dr.GetInt32("TopRow");
|
||||||
_PageLength = dr.GetInt32("PageLength");
|
_PageLength = dr.GetInt32("PageLength");
|
||||||
_LeftMargin = dr.GetInt32("LeftMargin");
|
_LeftMargin = dr.GetInt32("LeftMargin");
|
||||||
_PageWidth = dr.GetInt32("PageWidth");
|
_PageWidth = dr.GetInt32("PageWidth");
|
||||||
_PageCount = dr.GetDouble("PageCount");
|
_PageCount = dr.GetDouble("PageCount");
|
||||||
_DocPdf = (byte[])dr.GetValue("DocPdf");
|
_DocPdf = (byte[])dr.GetValue("DocPdf");
|
||||||
_DTS = dr.GetDateTime("DTS");
|
_DTS = dr.GetDateTime("DTS");
|
||||||
_UserID = dr.GetString("UserID");
|
_UserID = dr.GetString("UserID");
|
||||||
dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
|
dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
|
||||||
}
|
}
|
||||||
catch (Exception ex) // FKItem Fetch
|
catch (Exception ex) // FKItem Fetch
|
||||||
{
|
{
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocumentPdf.FetchDR", ex);
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocumentPdf.FetchDR", ex);
|
||||||
throw new DbCslaException("DocumentPdf.Fetch", ex);
|
throw new DbCslaException("DocumentPdf.Fetch", ex);
|
||||||
}
|
}
|
||||||
MarkOld();
|
MarkOld();
|
||||||
}
|
}
|
||||||
internal void Insert(Document myDocument)
|
internal void Insert(Document myDocument)
|
||||||
{
|
{
|
||||||
// if we're not dirty then don't update the database
|
// if we're not dirty then don't update the database
|
||||||
if (!this.IsDirty) return;
|
if (!this.IsDirty) return;
|
||||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||||
_LastChanged = Pdf.Add(cn, myDocument, _DebugStatus, _TopRow, _PageLength, _LeftMargin, _PageWidth, _PageCount, _DocPdf, _DTS, _UserID);
|
_LastChanged = Pdf.Add(cn, myDocument, _DebugStatus, _TopRow, _PageLength, _LeftMargin, _PageWidth, _PageCount, _DocPdf, _DTS, _UserID);
|
||||||
MarkOld();
|
MarkOld();
|
||||||
}
|
}
|
||||||
internal void Update(Document myDocument)
|
internal void Update(Document myDocument)
|
||||||
{
|
{
|
||||||
// if we're not dirty then don't update the database
|
// if we're not dirty then don't update the database
|
||||||
if (!this.IsDirty) return;
|
if (!this.IsDirty) return;
|
||||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||||
_LastChanged = Pdf.Update(cn, myDocument.DocID, _DebugStatus, _TopRow, _PageLength, _LeftMargin, _PageWidth, _PageCount, _DocPdf, _DTS, _UserID, ref _LastChanged);
|
_LastChanged = Pdf.Update(cn, myDocument.DocID, _DebugStatus, _TopRow, _PageLength, _LeftMargin, _PageWidth, _PageCount, _DocPdf, _DTS, _UserID, ref _LastChanged);
|
||||||
MarkOld();
|
MarkOld();
|
||||||
}
|
}
|
||||||
internal void DeleteSelf(Document myDocument)
|
internal void DeleteSelf(Document myDocument)
|
||||||
{
|
{
|
||||||
// if we're not dirty then don't update the database
|
// if we're not dirty then don't update the database
|
||||||
if (!this.IsDirty) return;
|
if (!this.IsDirty) return;
|
||||||
// if we're new then don't update the database
|
// if we're new then don't update the database
|
||||||
if (this.IsNew) return;
|
if (this.IsNew) return;
|
||||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||||
Pdf.Remove(cn, myDocument.DocID, _DebugStatus, _TopRow, _PageLength, _LeftMargin, _PageWidth);
|
Pdf.Remove(cn, myDocument.DocID, _DebugStatus, _TopRow, _PageLength, _LeftMargin, _PageWidth);
|
||||||
MarkNew();
|
MarkNew();
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
// Standard Default Code
|
// Standard Default Code
|
||||||
#region extension
|
#region extension
|
||||||
DocumentPdfExtension _DocumentPdfExtension = new DocumentPdfExtension();
|
DocumentPdfExtension _DocumentPdfExtension = new DocumentPdfExtension();
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
partial class DocumentPdfExtension : extensionBase
|
partial class DocumentPdfExtension : extensionBase
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
class extensionBase
|
class extensionBase
|
||||||
{
|
{
|
||||||
// Default Values
|
// Default Values
|
||||||
public virtual DateTime DefaultDTS
|
public virtual DateTime DefaultDTS
|
||||||
{
|
{
|
||||||
get { return DateTime.Now; }
|
get { return DateTime.Now; }
|
||||||
}
|
}
|
||||||
public virtual string DefaultUserID
|
public virtual string DefaultUserID
|
||||||
{
|
{
|
||||||
get { return Volian.Base.Library.VlnSettings.UserID; }
|
get { return Volian.Base.Library.VlnSettings.UserID; }
|
||||||
}
|
}
|
||||||
// Authorization Rules
|
// Authorization Rules
|
||||||
public virtual void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
|
public virtual void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
|
||||||
{
|
{
|
||||||
// Needs to be overriden to add new authorization rules
|
// Needs to be overriden to add new authorization rules
|
||||||
}
|
}
|
||||||
// Instance Authorization Rules
|
// Instance Authorization Rules
|
||||||
public virtual void AddInstanceAuthorizationRules(Csla.Security.AuthorizationRules rules)
|
public virtual void AddInstanceAuthorizationRules(Csla.Security.AuthorizationRules rules)
|
||||||
{
|
{
|
||||||
// Needs to be overriden to add new authorization rules
|
// Needs to be overriden to add new authorization rules
|
||||||
}
|
}
|
||||||
// Validation Rules
|
// Validation Rules
|
||||||
public virtual void AddValidationRules(Csla.Validation.ValidationRules rules)
|
public virtual void AddValidationRules(Csla.Validation.ValidationRules rules)
|
||||||
{
|
{
|
||||||
// Needs to be overriden to add new validation rules
|
// Needs to be overriden to add new validation rules
|
||||||
}
|
}
|
||||||
// InstanceValidation Rules
|
// InstanceValidation Rules
|
||||||
public virtual void AddInstanceValidationRules(Csla.Validation.ValidationRules rules)
|
public virtual void AddInstanceValidationRules(Csla.Validation.ValidationRules rules)
|
||||||
{
|
{
|
||||||
// Needs to be overriden to add new validation rules
|
// Needs to be overriden to add new validation rules
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
} // Class
|
} // Class
|
||||||
#region Converter
|
#region Converter
|
||||||
internal class DocumentPdfConverter : ExpandableObjectConverter
|
internal class DocumentPdfConverter : ExpandableObjectConverter
|
||||||
{
|
{
|
||||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
{
|
{
|
||||||
if (destType == typeof(string) && value is DocumentPdf)
|
if (destType == typeof(string) && value is DocumentPdf)
|
||||||
{
|
{
|
||||||
// Return the ToString value
|
// Return the ToString value
|
||||||
return ((DocumentPdf)value).ToString();
|
return ((DocumentPdf)value).ToString();
|
||||||
}
|
}
|
||||||
return base.ConvertTo(context, culture, value, destType);
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -19,349 +19,343 @@ using System.ComponentModel;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
public delegate void EntryAuditInfoEvent(object sender);
|
public delegate void EntryAuditInfoEvent(object sender);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// EntryAuditInfo Generated by MyGeneration using the CSLA Object Mapping template
|
/// EntryAuditInfo Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
[TypeConverter(typeof(EntryAuditInfoConverter))]
|
[TypeConverter(typeof(EntryAuditInfoConverter))]
|
||||||
public partial class EntryAuditInfo : ReadOnlyBase<EntryAuditInfo>, IDisposable
|
public partial class EntryAuditInfo : ReadOnlyBase<EntryAuditInfo>, IDisposable
|
||||||
{
|
{
|
||||||
public event EntryAuditInfoEvent Changed;
|
public event EntryAuditInfoEvent Changed;
|
||||||
private void OnChange()
|
private void OnChange()
|
||||||
{
|
{
|
||||||
if (Changed != null) Changed(this);
|
if (Changed != null) Changed(this);
|
||||||
}
|
}
|
||||||
#region Log4Net
|
#region Log4Net
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
private static List<EntryAuditInfo> _CacheList = new List<EntryAuditInfo>();
|
private static List<EntryAuditInfo> _CacheList = new List<EntryAuditInfo>();
|
||||||
protected static void AddToCache(EntryAuditInfo entryAuditInfo)
|
protected static void AddToCache(EntryAuditInfo entryAuditInfo)
|
||||||
{
|
{
|
||||||
if (!_CacheList.Contains(entryAuditInfo)) _CacheList.Add(entryAuditInfo); // In AddToCache
|
if (!_CacheList.Contains(entryAuditInfo)) _CacheList.Add(entryAuditInfo); // In AddToCache
|
||||||
}
|
}
|
||||||
protected static void RemoveFromCache(EntryAuditInfo entryAuditInfo)
|
protected static void RemoveFromCache(EntryAuditInfo entryAuditInfo)
|
||||||
{
|
{
|
||||||
while (_CacheList.Contains(entryAuditInfo)) _CacheList.Remove(entryAuditInfo); // In RemoveFromCache
|
while (_CacheList.Contains(entryAuditInfo)) _CacheList.Remove(entryAuditInfo); // In RemoveFromCache
|
||||||
}
|
}
|
||||||
private static Dictionary<string, List<EntryAuditInfo>> _CacheByPrimaryKey = new Dictionary<string, List<EntryAuditInfo>>();
|
private static Dictionary<string, List<EntryAuditInfo>> _CacheByPrimaryKey = new Dictionary<string, List<EntryAuditInfo>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
while (_CacheList.Count > 0) // Move EntryAuditInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
while (_CacheList.Count > 0) // Move EntryAuditInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
||||||
{
|
{
|
||||||
EntryAuditInfo tmp = _CacheList[0]; // Get the first EntryAuditInfo
|
EntryAuditInfo tmp = _CacheList[0]; // Get the first EntryAuditInfo
|
||||||
string pKey = tmp.AuditID.ToString();
|
string pKey = tmp.AuditID.ToString();
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
||||||
{
|
{
|
||||||
_CacheByPrimaryKey[pKey] = new List<EntryAuditInfo>(); // Add new list for PrimaryKey
|
_CacheByPrimaryKey[pKey] = new List<EntryAuditInfo>(); // Add new list for PrimaryKey
|
||||||
}
|
}
|
||||||
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
||||||
_CacheList.RemoveAt(0); // Remove the first EntryAuditInfo
|
_CacheList.RemoveAt(0); // Remove the first EntryAuditInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
internal static void AddList(EntryAuditInfoList lst)
|
internal static void AddList(EntryAuditInfoList lst)
|
||||||
{
|
{
|
||||||
foreach (EntryAuditInfo item in lst) AddToCache(item);
|
foreach (EntryAuditInfo item in lst) AddToCache(item);
|
||||||
}
|
}
|
||||||
protected static EntryAuditInfo GetCachedByPrimaryKey(long auditID)
|
protected static EntryAuditInfo GetCachedByPrimaryKey(long auditID)
|
||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = auditID.ToString();
|
string key = auditID.ToString();
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Business Methods
|
#region Business Methods
|
||||||
private string _ErrorMessage = string.Empty;
|
private string _ErrorMessage = string.Empty;
|
||||||
public string ErrorMessage
|
public string ErrorMessage
|
||||||
{
|
{
|
||||||
get { return _ErrorMessage; }
|
get { return _ErrorMessage; }
|
||||||
}
|
}
|
||||||
protected EntryAudit _Editable;
|
protected EntryAudit _Editable;
|
||||||
private IVEHasBrokenRules HasBrokenRules
|
private IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
IVEHasBrokenRules hasBrokenRules = null;
|
IVEHasBrokenRules hasBrokenRules = null;
|
||||||
if (_Editable != null)
|
if (_Editable != null)
|
||||||
hasBrokenRules = _Editable.HasBrokenRules;
|
hasBrokenRules = _Editable.HasBrokenRules;
|
||||||
return hasBrokenRules;
|
return hasBrokenRules;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private long _AuditID;
|
private long _AuditID;
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
public long AuditID
|
public long AuditID
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("AuditID", true);
|
return _AuditID;
|
||||||
return _AuditID;
|
}
|
||||||
}
|
}
|
||||||
}
|
private int _ContentID;
|
||||||
private int _ContentID;
|
public int ContentID
|
||||||
public int ContentID
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
get
|
||||||
get
|
{
|
||||||
{
|
return _ContentID;
|
||||||
CanReadProperty("ContentID", true);
|
}
|
||||||
return _ContentID;
|
}
|
||||||
}
|
private int _DocID;
|
||||||
}
|
public int DocID
|
||||||
private int _DocID;
|
{
|
||||||
public int DocID
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
return _DocID;
|
||||||
{
|
}
|
||||||
CanReadProperty("DocID", true);
|
}
|
||||||
return _DocID;
|
private DateTime _DTS = new DateTime();
|
||||||
}
|
public DateTime DTS
|
||||||
}
|
{
|
||||||
private DateTime _DTS = new DateTime();
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
public DateTime DTS
|
get
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
return _DTS;
|
||||||
get
|
}
|
||||||
{
|
}
|
||||||
CanReadProperty("DTS", true);
|
private string _UserID = string.Empty;
|
||||||
return _DTS;
|
public string UserID
|
||||||
}
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
private string _UserID = string.Empty;
|
get
|
||||||
public string UserID
|
{
|
||||||
{
|
return _UserID;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
}
|
||||||
{
|
private int _DeleteStatus;
|
||||||
CanReadProperty("UserID", true);
|
public int DeleteStatus
|
||||||
return _UserID;
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
private int _DeleteStatus;
|
{
|
||||||
public int DeleteStatus
|
return _DeleteStatus;
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
// CSLATODO: Replace base EntryAuditInfo.ToString function as necessary
|
||||||
{
|
/// <summary>
|
||||||
CanReadProperty("DeleteStatus", true);
|
/// Overrides Base ToString
|
||||||
return _DeleteStatus;
|
/// </summary>
|
||||||
}
|
/// <returns>A string representation of current EntryAuditInfo</returns>
|
||||||
}
|
//public override string ToString()
|
||||||
// CSLATODO: Replace base EntryAuditInfo.ToString function as necessary
|
//{
|
||||||
/// <summary>
|
// return base.ToString();
|
||||||
/// Overrides Base ToString
|
//}
|
||||||
/// </summary>
|
// CSLATODO: Check EntryAuditInfo.GetIdValue to assure that the ID returned is unique
|
||||||
/// <returns>A string representation of current EntryAuditInfo</returns>
|
/// <summary>
|
||||||
//public override string ToString()
|
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||||
//{
|
/// </summary>
|
||||||
// return base.ToString();
|
/// <returns>A Unique ID for the current EntryAuditInfo</returns>
|
||||||
//}
|
protected override object GetIdValue()
|
||||||
// CSLATODO: Check EntryAuditInfo.GetIdValue to assure that the ID returned is unique
|
{
|
||||||
/// <summary>
|
return MyEntryAuditInfoUnique; // Absolutely Unique ID
|
||||||
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
}
|
||||||
/// </summary>
|
#endregion
|
||||||
/// <returns>A Unique ID for the current EntryAuditInfo</returns>
|
#region Factory Methods
|
||||||
protected override object GetIdValue()
|
private static int _EntryAuditInfoUnique = 0;
|
||||||
{
|
private static int EntryAuditInfoUnique
|
||||||
return MyEntryAuditInfoUnique; // Absolutely Unique ID
|
{ get { return ++_EntryAuditInfoUnique; } }
|
||||||
}
|
private int _MyEntryAuditInfoUnique = EntryAuditInfoUnique;
|
||||||
#endregion
|
public int MyEntryAuditInfoUnique // Absolutely Unique ID - Info
|
||||||
#region Factory Methods
|
{ get { return _MyEntryAuditInfoUnique; } }
|
||||||
private static int _EntryAuditInfoUnique = 0;
|
protected EntryAuditInfo()
|
||||||
private static int EntryAuditInfoUnique
|
{/* require use of factory methods */
|
||||||
{ get { return ++_EntryAuditInfoUnique; } }
|
AddToCache(this);
|
||||||
private int _MyEntryAuditInfoUnique = EntryAuditInfoUnique;
|
}
|
||||||
public int MyEntryAuditInfoUnique // Absolutely Unique ID - Info
|
private bool _Disposed = false;
|
||||||
{ get { return _MyEntryAuditInfoUnique; } }
|
private static int _CountCreated = 0;
|
||||||
protected EntryAuditInfo()
|
private static int _CountDisposed = 0;
|
||||||
{/* require use of factory methods */
|
private static int _CountFinalized = 0;
|
||||||
AddToCache(this);
|
private static int IncrementCountCreated
|
||||||
}
|
{ get { return ++_CountCreated; } }
|
||||||
private bool _Disposed = false;
|
private int _CountWhenCreated = IncrementCountCreated;
|
||||||
private static int _CountCreated = 0;
|
public static int CountCreated
|
||||||
private static int _CountDisposed = 0;
|
{ get { return _CountCreated; } }
|
||||||
private static int _CountFinalized = 0;
|
public static int CountNotDisposed
|
||||||
private static int IncrementCountCreated
|
{ get { return _CountCreated - _CountDisposed; } }
|
||||||
{ get { return ++_CountCreated; } }
|
public static int CountNotFinalized
|
||||||
private int _CountWhenCreated = IncrementCountCreated;
|
{ get { return _CountCreated - _CountFinalized; } }
|
||||||
public static int CountCreated
|
~EntryAuditInfo()
|
||||||
{ get { return _CountCreated; } }
|
{
|
||||||
public static int CountNotDisposed
|
_CountFinalized++;
|
||||||
{ get { return _CountCreated - _CountDisposed; } }
|
}
|
||||||
public static int CountNotFinalized
|
public void Dispose()
|
||||||
{ get { return _CountCreated - _CountFinalized; } }
|
{
|
||||||
~EntryAuditInfo()
|
if (_Disposed) return;
|
||||||
{
|
_CountDisposed++;
|
||||||
_CountFinalized++;
|
_Disposed = true;
|
||||||
}
|
RemoveFromCache(this);
|
||||||
public void Dispose()
|
if (!_CacheByPrimaryKey.ContainsKey(AuditID.ToString())) return;
|
||||||
{
|
List<EntryAuditInfo> listEntryAuditInfo = _CacheByPrimaryKey[AuditID.ToString()]; // Get the list of items
|
||||||
if (_Disposed) return;
|
while (listEntryAuditInfo.Contains(this)) listEntryAuditInfo.Remove(this); // Remove the item from the list
|
||||||
_CountDisposed++;
|
if (listEntryAuditInfo.Count == 0) // If there are no items left in the list
|
||||||
_Disposed = true;
|
_CacheByPrimaryKey.Remove(AuditID.ToString()); // remove the list
|
||||||
RemoveFromCache(this);
|
}
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(AuditID.ToString())) return;
|
public virtual EntryAudit Get()
|
||||||
List<EntryAuditInfo> listEntryAuditInfo = _CacheByPrimaryKey[AuditID.ToString()]; // Get the list of items
|
{
|
||||||
while (listEntryAuditInfo.Contains(this)) listEntryAuditInfo.Remove(this); // Remove the item from the list
|
return _Editable = EntryAudit.Get(_AuditID);
|
||||||
if (listEntryAuditInfo.Count == 0) // If there are no items left in the list
|
}
|
||||||
_CacheByPrimaryKey.Remove(AuditID.ToString()); // remove the list
|
public static void Refresh(EntryAudit tmp)
|
||||||
}
|
{
|
||||||
public virtual EntryAudit Get()
|
string key = tmp.AuditID.ToString();
|
||||||
{
|
ConvertListToDictionary();
|
||||||
return _Editable = EntryAudit.Get(_AuditID);
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
}
|
foreach (EntryAuditInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
public static void Refresh(EntryAudit tmp)
|
tmpInfo.RefreshFields(tmp);
|
||||||
{
|
}
|
||||||
string key = tmp.AuditID.ToString();
|
protected virtual void RefreshFields(EntryAudit tmp)
|
||||||
ConvertListToDictionary();
|
{
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
_ContentID = tmp.ContentID;
|
||||||
foreach (EntryAuditInfo tmpInfo in _CacheByPrimaryKey[key])
|
_DocID = tmp.DocID;
|
||||||
tmpInfo.RefreshFields(tmp);
|
_DTS = tmp.DTS;
|
||||||
}
|
_UserID = tmp.UserID;
|
||||||
protected virtual void RefreshFields(EntryAudit tmp)
|
_DeleteStatus = tmp.DeleteStatus;
|
||||||
{
|
_EntryAuditInfoExtension.Refresh(this);
|
||||||
_ContentID = tmp.ContentID;
|
OnChange();// raise an event
|
||||||
_DocID = tmp.DocID;
|
}
|
||||||
_DTS = tmp.DTS;
|
public static EntryAuditInfo Get(long auditID)
|
||||||
_UserID = tmp.UserID;
|
{
|
||||||
_DeleteStatus = tmp.DeleteStatus;
|
//if (!CanGetObject())
|
||||||
_EntryAuditInfoExtension.Refresh(this);
|
// throw new System.Security.SecurityException("User not authorized to view a EntryAudit");
|
||||||
OnChange();// raise an event
|
try
|
||||||
}
|
{
|
||||||
public static EntryAuditInfo Get(long auditID)
|
EntryAuditInfo tmp = GetCachedByPrimaryKey(auditID);
|
||||||
{
|
if (tmp == null)
|
||||||
//if (!CanGetObject())
|
{
|
||||||
// throw new System.Security.SecurityException("User not authorized to view a EntryAudit");
|
tmp = DataPortal.Fetch<EntryAuditInfo>(new PKCriteria(auditID));
|
||||||
try
|
AddToCache(tmp);
|
||||||
{
|
}
|
||||||
EntryAuditInfo tmp = GetCachedByPrimaryKey(auditID);
|
if (tmp.ErrorMessage == "No Record Found")
|
||||||
if (tmp == null)
|
{
|
||||||
{
|
tmp.Dispose(); // Clean-up EntryAuditInfo
|
||||||
tmp = DataPortal.Fetch<EntryAuditInfo>(new PKCriteria(auditID));
|
tmp = null;
|
||||||
AddToCache(tmp);
|
}
|
||||||
}
|
return tmp;
|
||||||
if (tmp.ErrorMessage == "No Record Found")
|
}
|
||||||
{
|
catch (Exception ex)
|
||||||
tmp.Dispose(); // Clean-up EntryAuditInfo
|
{
|
||||||
tmp = null;
|
throw new DbCslaException("Error on EntryAuditInfo.Get", ex);
|
||||||
}
|
}
|
||||||
return tmp;
|
}
|
||||||
}
|
#endregion
|
||||||
catch (Exception ex)
|
#region Data Access Portal
|
||||||
{
|
internal EntryAuditInfo(SafeDataReader dr)
|
||||||
throw new DbCslaException("Error on EntryAuditInfo.Get", ex);
|
{
|
||||||
}
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] EntryAuditInfo.Constructor", GetHashCode());
|
||||||
}
|
try
|
||||||
#endregion
|
{
|
||||||
#region Data Access Portal
|
ReadData(dr);
|
||||||
internal EntryAuditInfo(SafeDataReader dr)
|
}
|
||||||
{
|
catch (Exception ex)
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] EntryAuditInfo.Constructor", GetHashCode());
|
{
|
||||||
try
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("EntryAuditInfo.Constructor", ex);
|
||||||
{
|
throw new DbCslaException("EntryAuditInfo.Constructor", ex);
|
||||||
ReadData(dr);
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
[Serializable()]
|
||||||
{
|
protected class PKCriteria
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("EntryAuditInfo.Constructor", ex);
|
{
|
||||||
throw new DbCslaException("EntryAuditInfo.Constructor", ex);
|
private long _AuditID;
|
||||||
}
|
public long AuditID
|
||||||
}
|
{ get { return _AuditID; } }
|
||||||
[Serializable()]
|
public PKCriteria(long auditID)
|
||||||
protected class PKCriteria
|
{
|
||||||
{
|
_AuditID = auditID;
|
||||||
private long _AuditID;
|
}
|
||||||
public long AuditID
|
}
|
||||||
{ get { return _AuditID; } }
|
private void ReadData(SafeDataReader dr)
|
||||||
public PKCriteria(long auditID)
|
{
|
||||||
{
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] EntryAuditInfo.ReadData", GetHashCode());
|
||||||
_AuditID = auditID;
|
try
|
||||||
}
|
{
|
||||||
}
|
_AuditID = dr.GetInt64("AuditID");
|
||||||
private void ReadData(SafeDataReader dr)
|
_ContentID = dr.GetInt32("ContentID");
|
||||||
{
|
_DocID = dr.GetInt32("DocID");
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] EntryAuditInfo.ReadData", GetHashCode());
|
_DTS = dr.GetDateTime("DTS");
|
||||||
try
|
_UserID = dr.GetString("UserID");
|
||||||
{
|
_DeleteStatus = dr.GetInt32("DeleteStatus");
|
||||||
_AuditID = dr.GetInt64("AuditID");
|
}
|
||||||
_ContentID = dr.GetInt32("ContentID");
|
catch (Exception ex)
|
||||||
_DocID = dr.GetInt32("DocID");
|
{
|
||||||
_DTS = dr.GetDateTime("DTS");
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("EntryAuditInfo.ReadData", ex);
|
||||||
_UserID = dr.GetString("UserID");
|
_ErrorMessage = ex.Message;
|
||||||
_DeleteStatus = dr.GetInt32("DeleteStatus");
|
throw new DbCslaException("EntryAuditInfo.ReadData", ex);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
}
|
||||||
{
|
private void DataPortal_Fetch(PKCriteria criteria)
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("EntryAuditInfo.ReadData", ex);
|
{
|
||||||
_ErrorMessage = ex.Message;
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] EntryAuditInfo.DataPortal_Fetch", GetHashCode());
|
||||||
throw new DbCslaException("EntryAuditInfo.ReadData", ex);
|
try
|
||||||
}
|
{
|
||||||
}
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
private void DataPortal_Fetch(PKCriteria criteria)
|
{
|
||||||
{
|
ApplicationContext.LocalContext["cn"] = cn;
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] EntryAuditInfo.DataPortal_Fetch", GetHashCode());
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
try
|
{
|
||||||
{
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
cm.CommandText = "getEntryAudit";
|
||||||
{
|
cm.Parameters.AddWithValue("@AuditID", criteria.AuditID);
|
||||||
ApplicationContext.LocalContext["cn"] = cn;
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
using (SqlCommand cm = cn.CreateCommand())
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
{
|
{
|
||||||
cm.CommandType = CommandType.StoredProcedure;
|
if (!dr.Read())
|
||||||
cm.CommandText = "getEntryAudit";
|
{
|
||||||
cm.Parameters.AddWithValue("@AuditID", criteria.AuditID);
|
_ErrorMessage = "No Record Found";
|
||||||
cm.CommandTimeout = Database.DefaultTimeout;
|
return;
|
||||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
}
|
||||||
{
|
ReadData(dr);
|
||||||
if (!dr.Read())
|
}
|
||||||
{
|
}
|
||||||
_ErrorMessage = "No Record Found";
|
// removing of item only needed for local data portal
|
||||||
return;
|
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
||||||
}
|
ApplicationContext.LocalContext.Remove("cn");
|
||||||
ReadData(dr);
|
}
|
||||||
}
|
}
|
||||||
}
|
catch (Exception ex)
|
||||||
// removing of item only needed for local data portal
|
{
|
||||||
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("EntryAuditInfo.DataPortal_Fetch", ex);
|
||||||
ApplicationContext.LocalContext.Remove("cn");
|
_ErrorMessage = ex.Message;
|
||||||
}
|
throw new DbCslaException("EntryAuditInfo.DataPortal_Fetch", ex);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
}
|
||||||
{
|
#endregion
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("EntryAuditInfo.DataPortal_Fetch", ex);
|
// Standard Refresh
|
||||||
_ErrorMessage = ex.Message;
|
#region extension
|
||||||
throw new DbCslaException("EntryAuditInfo.DataPortal_Fetch", ex);
|
EntryAuditInfoExtension _EntryAuditInfoExtension = new EntryAuditInfoExtension();
|
||||||
}
|
[Serializable()]
|
||||||
}
|
partial class EntryAuditInfoExtension : extensionBase { }
|
||||||
#endregion
|
[Serializable()]
|
||||||
// Standard Refresh
|
class extensionBase
|
||||||
#region extension
|
{
|
||||||
EntryAuditInfoExtension _EntryAuditInfoExtension = new EntryAuditInfoExtension();
|
// Default Refresh
|
||||||
[Serializable()]
|
public virtual void Refresh(EntryAuditInfo tmp) { }
|
||||||
partial class EntryAuditInfoExtension : extensionBase { }
|
}
|
||||||
[Serializable()]
|
#endregion
|
||||||
class extensionBase
|
} // Class
|
||||||
{
|
#region Converter
|
||||||
// Default Refresh
|
internal class EntryAuditInfoConverter : ExpandableObjectConverter
|
||||||
public virtual void Refresh(EntryAuditInfo tmp) { }
|
{
|
||||||
}
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
#endregion
|
{
|
||||||
} // Class
|
if (destType == typeof(string) && value is EntryAuditInfo)
|
||||||
#region Converter
|
{
|
||||||
internal class EntryAuditInfoConverter : ExpandableObjectConverter
|
// Return the ToString value
|
||||||
{
|
return ((EntryAuditInfo)value).ToString();
|
||||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
}
|
||||||
{
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
if (destType == typeof(string) && value is EntryAuditInfo)
|
}
|
||||||
{
|
}
|
||||||
// Return the ToString value
|
#endregion
|
||||||
return ((EntryAuditInfo)value).ToString();
|
|
||||||
}
|
|
||||||
return base.ConvertTo(context, culture, value, destType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
@ -19,371 +19,365 @@ using System.ComponentModel;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
public delegate void EntryInfoEvent(object sender);
|
public delegate void EntryInfoEvent(object sender);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// EntryInfo Generated by MyGeneration using the CSLA Object Mapping template
|
/// EntryInfo Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
[TypeConverter(typeof(EntryInfoConverter))]
|
[TypeConverter(typeof(EntryInfoConverter))]
|
||||||
public partial class EntryInfo : ReadOnlyBase<EntryInfo>, IDisposable
|
public partial class EntryInfo : ReadOnlyBase<EntryInfo>, IDisposable
|
||||||
{
|
{
|
||||||
public event EntryInfoEvent Changed;
|
public event EntryInfoEvent Changed;
|
||||||
private void OnChange()
|
private void OnChange()
|
||||||
{
|
{
|
||||||
if (Changed != null) Changed(this);
|
if (Changed != null) Changed(this);
|
||||||
}
|
}
|
||||||
#region Log4Net
|
#region Log4Net
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
private static List<EntryInfo> _CacheList = new List<EntryInfo>();
|
private static List<EntryInfo> _CacheList = new List<EntryInfo>();
|
||||||
protected static void AddToCache(EntryInfo entryInfo)
|
protected static void AddToCache(EntryInfo entryInfo)
|
||||||
{
|
{
|
||||||
if (!_CacheList.Contains(entryInfo)) _CacheList.Add(entryInfo); // In AddToCache
|
if (!_CacheList.Contains(entryInfo)) _CacheList.Add(entryInfo); // In AddToCache
|
||||||
}
|
}
|
||||||
protected static void RemoveFromCache(EntryInfo entryInfo)
|
protected static void RemoveFromCache(EntryInfo entryInfo)
|
||||||
{
|
{
|
||||||
while (_CacheList.Contains(entryInfo)) _CacheList.Remove(entryInfo); // In RemoveFromCache
|
while (_CacheList.Contains(entryInfo)) _CacheList.Remove(entryInfo); // In RemoveFromCache
|
||||||
}
|
}
|
||||||
private static Dictionary<string, List<EntryInfo>> _CacheByPrimaryKey = new Dictionary<string, List<EntryInfo>>();
|
private static Dictionary<string, List<EntryInfo>> _CacheByPrimaryKey = new Dictionary<string, List<EntryInfo>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
while (_CacheList.Count > 0) // Move EntryInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
while (_CacheList.Count > 0) // Move EntryInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
||||||
{
|
{
|
||||||
EntryInfo tmp = _CacheList[0]; // Get the first EntryInfo
|
EntryInfo tmp = _CacheList[0]; // Get the first EntryInfo
|
||||||
string pKey = tmp.ContentID.ToString();
|
string pKey = tmp.ContentID.ToString();
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
||||||
{
|
{
|
||||||
_CacheByPrimaryKey[pKey] = new List<EntryInfo>(); // Add new list for PrimaryKey
|
_CacheByPrimaryKey[pKey] = new List<EntryInfo>(); // Add new list for PrimaryKey
|
||||||
}
|
}
|
||||||
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
||||||
_CacheList.RemoveAt(0); // Remove the first EntryInfo
|
_CacheList.RemoveAt(0); // Remove the first EntryInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
internal static void AddList(EntryInfoList lst)
|
internal static void AddList(EntryInfoList lst)
|
||||||
{
|
{
|
||||||
foreach (EntryInfo item in lst) AddToCache(item);
|
foreach (EntryInfo item in lst) AddToCache(item);
|
||||||
}
|
}
|
||||||
protected static EntryInfo GetCachedByPrimaryKey(int contentID)
|
protected static EntryInfo GetCachedByPrimaryKey(int contentID)
|
||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = contentID.ToString();
|
string key = contentID.ToString();
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Business Methods
|
#region Business Methods
|
||||||
private string _ErrorMessage = string.Empty;
|
private string _ErrorMessage = string.Empty;
|
||||||
public string ErrorMessage
|
public string ErrorMessage
|
||||||
{
|
{
|
||||||
get { return _ErrorMessage; }
|
get { return _ErrorMessage; }
|
||||||
}
|
}
|
||||||
protected Entry _Editable;
|
protected Entry _Editable;
|
||||||
private IVEHasBrokenRules HasBrokenRules
|
private IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
IVEHasBrokenRules hasBrokenRules = null;
|
IVEHasBrokenRules hasBrokenRules = null;
|
||||||
if (_Editable != null)
|
if (_Editable != null)
|
||||||
hasBrokenRules = _Editable.HasBrokenRules;
|
hasBrokenRules = _Editable.HasBrokenRules;
|
||||||
return hasBrokenRules;
|
return hasBrokenRules;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private int _ContentID;
|
private int _ContentID;
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
public int ContentID
|
public int ContentID
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("ContentID", true);
|
if (_MyContent != null) _ContentID = _MyContent.ContentID;
|
||||||
if (_MyContent != null) _ContentID = _MyContent.ContentID;
|
return _ContentID;
|
||||||
return _ContentID;
|
}
|
||||||
}
|
}
|
||||||
}
|
private ContentInfo _MyContent;
|
||||||
private ContentInfo _MyContent;
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
public ContentInfo MyContent
|
||||||
public ContentInfo MyContent
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
get
|
||||||
get
|
{
|
||||||
{
|
if (_MyContent == null && _ContentID != 0) _MyContent = ContentInfo.Get(_ContentID);
|
||||||
CanReadProperty("MyContent", true);
|
return _MyContent;
|
||||||
if (_MyContent == null && _ContentID != 0) _MyContent = ContentInfo.Get(_ContentID);
|
}
|
||||||
return _MyContent;
|
}
|
||||||
}
|
private int _DocID;
|
||||||
}
|
public int DocID
|
||||||
private int _DocID;
|
{
|
||||||
public int DocID
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
if (_MyDocument != null) _DocID = _MyDocument.DocID;
|
||||||
{
|
return _DocID;
|
||||||
CanReadProperty("DocID", true);
|
}
|
||||||
if (_MyDocument != null) _DocID = _MyDocument.DocID;
|
}
|
||||||
return _DocID;
|
private DocumentInfo _MyDocument;
|
||||||
}
|
public DocumentInfo MyDocument
|
||||||
}
|
{
|
||||||
private DocumentInfo _MyDocument;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
public DocumentInfo MyDocument
|
get
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
if (_MyDocument == null && _DocID != 0) _MyDocument = DocumentInfo.Get(_DocID);
|
||||||
get
|
return _MyDocument;
|
||||||
{
|
}
|
||||||
CanReadProperty("MyDocument", true);
|
}
|
||||||
if (_MyDocument == null && _DocID != 0) _MyDocument = DocumentInfo.Get(_DocID);
|
private DateTime _DTS = new DateTime();
|
||||||
return _MyDocument;
|
public DateTime DTS
|
||||||
}
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
private DateTime _DTS = new DateTime();
|
get
|
||||||
public DateTime DTS
|
{
|
||||||
{
|
return _DTS;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
}
|
||||||
{
|
private string _UserID = string.Empty;
|
||||||
CanReadProperty("DTS", true);
|
public string UserID
|
||||||
return _DTS;
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
private string _UserID = string.Empty;
|
{
|
||||||
public string UserID
|
return _UserID;
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
// CSLATODO: Replace base EntryInfo.ToString function as necessary
|
||||||
{
|
/// <summary>
|
||||||
CanReadProperty("UserID", true);
|
/// Overrides Base ToString
|
||||||
return _UserID;
|
/// </summary>
|
||||||
}
|
/// <returns>A string representation of current EntryInfo</returns>
|
||||||
}
|
//public override string ToString()
|
||||||
// CSLATODO: Replace base EntryInfo.ToString function as necessary
|
//{
|
||||||
/// <summary>
|
// return base.ToString();
|
||||||
/// Overrides Base ToString
|
//}
|
||||||
/// </summary>
|
// CSLATODO: Check EntryInfo.GetIdValue to assure that the ID returned is unique
|
||||||
/// <returns>A string representation of current EntryInfo</returns>
|
/// <summary>
|
||||||
//public override string ToString()
|
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||||
//{
|
/// </summary>
|
||||||
// return base.ToString();
|
/// <returns>A Unique ID for the current EntryInfo</returns>
|
||||||
//}
|
protected override object GetIdValue()
|
||||||
// CSLATODO: Check EntryInfo.GetIdValue to assure that the ID returned is unique
|
{
|
||||||
/// <summary>
|
return MyEntryInfoUnique; // Absolutely Unique ID
|
||||||
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
}
|
||||||
/// </summary>
|
#endregion
|
||||||
/// <returns>A Unique ID for the current EntryInfo</returns>
|
#region Factory Methods
|
||||||
protected override object GetIdValue()
|
private static int _EntryInfoUnique = 0;
|
||||||
{
|
private static int EntryInfoUnique
|
||||||
return MyEntryInfoUnique; // Absolutely Unique ID
|
{ get { return ++_EntryInfoUnique; } }
|
||||||
}
|
private int _MyEntryInfoUnique = EntryInfoUnique;
|
||||||
#endregion
|
public int MyEntryInfoUnique // Absolutely Unique ID - Info
|
||||||
#region Factory Methods
|
{ get { return _MyEntryInfoUnique; } }
|
||||||
private static int _EntryInfoUnique = 0;
|
protected EntryInfo()
|
||||||
private static int EntryInfoUnique
|
{/* require use of factory methods */
|
||||||
{ get { return ++_EntryInfoUnique; } }
|
AddToCache(this);
|
||||||
private int _MyEntryInfoUnique = EntryInfoUnique;
|
}
|
||||||
public int MyEntryInfoUnique // Absolutely Unique ID - Info
|
private bool _Disposed = false;
|
||||||
{ get { return _MyEntryInfoUnique; } }
|
private static int _CountCreated = 0;
|
||||||
protected EntryInfo()
|
private static int _CountDisposed = 0;
|
||||||
{/* require use of factory methods */
|
private static int _CountFinalized = 0;
|
||||||
AddToCache(this);
|
private static int IncrementCountCreated
|
||||||
}
|
{ get { return ++_CountCreated; } }
|
||||||
private bool _Disposed = false;
|
private int _CountWhenCreated = IncrementCountCreated;
|
||||||
private static int _CountCreated = 0;
|
public static int CountCreated
|
||||||
private static int _CountDisposed = 0;
|
{ get { return _CountCreated; } }
|
||||||
private static int _CountFinalized = 0;
|
public static int CountNotDisposed
|
||||||
private static int IncrementCountCreated
|
{ get { return _CountCreated - _CountDisposed; } }
|
||||||
{ get { return ++_CountCreated; } }
|
public static int CountNotFinalized
|
||||||
private int _CountWhenCreated = IncrementCountCreated;
|
{ get { return _CountCreated - _CountFinalized; } }
|
||||||
public static int CountCreated
|
~EntryInfo()
|
||||||
{ get { return _CountCreated; } }
|
{
|
||||||
public static int CountNotDisposed
|
_CountFinalized++;
|
||||||
{ get { return _CountCreated - _CountDisposed; } }
|
}
|
||||||
public static int CountNotFinalized
|
public void Dispose()
|
||||||
{ get { return _CountCreated - _CountFinalized; } }
|
{
|
||||||
~EntryInfo()
|
if (_Disposed) return;
|
||||||
{
|
_CountDisposed++;
|
||||||
_CountFinalized++;
|
_Disposed = true;
|
||||||
}
|
RemoveFromCache(this);
|
||||||
public void Dispose()
|
if (!_CacheByPrimaryKey.ContainsKey(ContentID.ToString())) return;
|
||||||
{
|
List<EntryInfo> listEntryInfo = _CacheByPrimaryKey[ContentID.ToString()]; // Get the list of items
|
||||||
if (_Disposed) return;
|
while (listEntryInfo.Contains(this)) listEntryInfo.Remove(this); // Remove the item from the list
|
||||||
_CountDisposed++;
|
if (listEntryInfo.Count == 0) // If there are no items left in the list
|
||||||
_Disposed = true;
|
_CacheByPrimaryKey.Remove(ContentID.ToString()); // remove the list
|
||||||
RemoveFromCache(this);
|
}
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(ContentID.ToString())) return;
|
public virtual Entry Get()
|
||||||
List<EntryInfo> listEntryInfo = _CacheByPrimaryKey[ContentID.ToString()]; // Get the list of items
|
{
|
||||||
while (listEntryInfo.Contains(this)) listEntryInfo.Remove(this); // Remove the item from the list
|
return _Editable = Entry.Get(_ContentID);
|
||||||
if (listEntryInfo.Count == 0) // If there are no items left in the list
|
}
|
||||||
_CacheByPrimaryKey.Remove(ContentID.ToString()); // remove the list
|
public static void Refresh(Entry tmp)
|
||||||
}
|
{
|
||||||
public virtual Entry Get()
|
string key = tmp.ContentID.ToString();
|
||||||
{
|
ConvertListToDictionary();
|
||||||
return _Editable = Entry.Get(_ContentID);
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
}
|
foreach (EntryInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
public static void Refresh(Entry tmp)
|
tmpInfo.RefreshFields(tmp);
|
||||||
{
|
}
|
||||||
string key = tmp.ContentID.ToString();
|
protected virtual void RefreshFields(Entry tmp)
|
||||||
ConvertListToDictionary();
|
{
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
if (_DocID != tmp.DocID)
|
||||||
foreach (EntryInfo tmpInfo in _CacheByPrimaryKey[key])
|
{
|
||||||
tmpInfo.RefreshFields(tmp);
|
if (MyDocument != null) MyDocument.RefreshDocumentEntries(); // Update List for old value
|
||||||
}
|
_DocID = tmp.DocID; // Update the value
|
||||||
protected virtual void RefreshFields(Entry tmp)
|
}
|
||||||
{
|
_MyDocument = null; // Reset list so that the next line gets a new list
|
||||||
if (_DocID != tmp.DocID)
|
if (MyDocument != null) MyDocument.RefreshDocumentEntries(); // Update List for new value
|
||||||
{
|
_DTS = tmp.DTS;
|
||||||
if (MyDocument != null) MyDocument.RefreshDocumentEntries(); // Update List for old value
|
_UserID = tmp.UserID;
|
||||||
_DocID = tmp.DocID; // Update the value
|
_EntryInfoExtension.Refresh(this);
|
||||||
}
|
OnChange();// raise an event
|
||||||
_MyDocument = null; // Reset list so that the next line gets a new list
|
}
|
||||||
if (MyDocument != null) MyDocument.RefreshDocumentEntries(); // Update List for new value
|
public static void Refresh(DocumentEntry tmp)
|
||||||
_DTS = tmp.DTS;
|
{
|
||||||
_UserID = tmp.UserID;
|
string key = tmp.ContentID.ToString();
|
||||||
_EntryInfoExtension.Refresh(this);
|
ConvertListToDictionary();
|
||||||
OnChange();// raise an event
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
}
|
foreach (EntryInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
public static void Refresh(DocumentEntry tmp)
|
tmpInfo.RefreshFields(tmp);
|
||||||
{
|
}
|
||||||
string key = tmp.ContentID.ToString();
|
protected virtual void RefreshFields(DocumentEntry tmp)
|
||||||
ConvertListToDictionary();
|
{
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
_DTS = tmp.DTS;
|
||||||
foreach (EntryInfo tmpInfo in _CacheByPrimaryKey[key])
|
_UserID = tmp.UserID;
|
||||||
tmpInfo.RefreshFields(tmp);
|
_EntryInfoExtension.Refresh(this);
|
||||||
}
|
OnChange();// raise an event
|
||||||
protected virtual void RefreshFields(DocumentEntry tmp)
|
}
|
||||||
{
|
public static EntryInfo Get(int contentID)
|
||||||
_DTS = tmp.DTS;
|
{
|
||||||
_UserID = tmp.UserID;
|
//if (!CanGetObject())
|
||||||
_EntryInfoExtension.Refresh(this);
|
// throw new System.Security.SecurityException("User not authorized to view a Entry");
|
||||||
OnChange();// raise an event
|
try
|
||||||
}
|
{
|
||||||
public static EntryInfo Get(int contentID)
|
EntryInfo tmp = GetCachedByPrimaryKey(contentID);
|
||||||
{
|
if (tmp == null)
|
||||||
//if (!CanGetObject())
|
{
|
||||||
// throw new System.Security.SecurityException("User not authorized to view a Entry");
|
tmp = DataPortal.Fetch<EntryInfo>(new PKCriteria(contentID));
|
||||||
try
|
AddToCache(tmp);
|
||||||
{
|
}
|
||||||
EntryInfo tmp = GetCachedByPrimaryKey(contentID);
|
if (tmp.ErrorMessage == "No Record Found")
|
||||||
if (tmp == null)
|
{
|
||||||
{
|
tmp.Dispose(); // Clean-up EntryInfo
|
||||||
tmp = DataPortal.Fetch<EntryInfo>(new PKCriteria(contentID));
|
tmp = null;
|
||||||
AddToCache(tmp);
|
}
|
||||||
}
|
return tmp;
|
||||||
if (tmp.ErrorMessage == "No Record Found")
|
}
|
||||||
{
|
catch (Exception ex)
|
||||||
tmp.Dispose(); // Clean-up EntryInfo
|
{
|
||||||
tmp = null;
|
throw new DbCslaException("Error on EntryInfo.Get", ex);
|
||||||
}
|
}
|
||||||
return tmp;
|
}
|
||||||
}
|
#endregion
|
||||||
catch (Exception ex)
|
#region Data Access Portal
|
||||||
{
|
internal EntryInfo(SafeDataReader dr)
|
||||||
throw new DbCslaException("Error on EntryInfo.Get", ex);
|
{
|
||||||
}
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] EntryInfo.Constructor", GetHashCode());
|
||||||
}
|
try
|
||||||
#endregion
|
{
|
||||||
#region Data Access Portal
|
ReadData(dr);
|
||||||
internal EntryInfo(SafeDataReader dr)
|
}
|
||||||
{
|
catch (Exception ex)
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] EntryInfo.Constructor", GetHashCode());
|
{
|
||||||
try
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("EntryInfo.Constructor", ex);
|
||||||
{
|
throw new DbCslaException("EntryInfo.Constructor", ex);
|
||||||
ReadData(dr);
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
[Serializable()]
|
||||||
{
|
protected class PKCriteria
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("EntryInfo.Constructor", ex);
|
{
|
||||||
throw new DbCslaException("EntryInfo.Constructor", ex);
|
private int _ContentID;
|
||||||
}
|
public int ContentID
|
||||||
}
|
{ get { return _ContentID; } }
|
||||||
[Serializable()]
|
public PKCriteria(int contentID)
|
||||||
protected class PKCriteria
|
{
|
||||||
{
|
_ContentID = contentID;
|
||||||
private int _ContentID;
|
}
|
||||||
public int ContentID
|
}
|
||||||
{ get { return _ContentID; } }
|
private void ReadData(SafeDataReader dr)
|
||||||
public PKCriteria(int contentID)
|
{
|
||||||
{
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] EntryInfo.ReadData", GetHashCode());
|
||||||
_ContentID = contentID;
|
try
|
||||||
}
|
{
|
||||||
}
|
_ContentID = dr.GetInt32("ContentID");
|
||||||
private void ReadData(SafeDataReader dr)
|
_DocID = dr.GetInt32("DocID");
|
||||||
{
|
_DTS = dr.GetDateTime("DTS");
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] EntryInfo.ReadData", GetHashCode());
|
_UserID = dr.GetString("UserID");
|
||||||
try
|
}
|
||||||
{
|
catch (Exception ex)
|
||||||
_ContentID = dr.GetInt32("ContentID");
|
{
|
||||||
_DocID = dr.GetInt32("DocID");
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("EntryInfo.ReadData", ex);
|
||||||
_DTS = dr.GetDateTime("DTS");
|
_ErrorMessage = ex.Message;
|
||||||
_UserID = dr.GetString("UserID");
|
throw new DbCslaException("EntryInfo.ReadData", ex);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
}
|
||||||
{
|
private void DataPortal_Fetch(PKCriteria criteria)
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("EntryInfo.ReadData", ex);
|
{
|
||||||
_ErrorMessage = ex.Message;
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] EntryInfo.DataPortal_Fetch", GetHashCode());
|
||||||
throw new DbCslaException("EntryInfo.ReadData", ex);
|
try
|
||||||
}
|
{
|
||||||
}
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
private void DataPortal_Fetch(PKCriteria criteria)
|
{
|
||||||
{
|
ApplicationContext.LocalContext["cn"] = cn;
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] EntryInfo.DataPortal_Fetch", GetHashCode());
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
try
|
{
|
||||||
{
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
cm.CommandText = "getEntry";
|
||||||
{
|
cm.Parameters.AddWithValue("@ContentID", criteria.ContentID);
|
||||||
ApplicationContext.LocalContext["cn"] = cn;
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
using (SqlCommand cm = cn.CreateCommand())
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
{
|
{
|
||||||
cm.CommandType = CommandType.StoredProcedure;
|
if (!dr.Read())
|
||||||
cm.CommandText = "getEntry";
|
{
|
||||||
cm.Parameters.AddWithValue("@ContentID", criteria.ContentID);
|
_ErrorMessage = "No Record Found";
|
||||||
cm.CommandTimeout = Database.DefaultTimeout;
|
return;
|
||||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
}
|
||||||
{
|
ReadData(dr);
|
||||||
if (!dr.Read())
|
}
|
||||||
{
|
}
|
||||||
_ErrorMessage = "No Record Found";
|
// removing of item only needed for local data portal
|
||||||
return;
|
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
||||||
}
|
ApplicationContext.LocalContext.Remove("cn");
|
||||||
ReadData(dr);
|
}
|
||||||
}
|
}
|
||||||
}
|
catch (Exception ex)
|
||||||
// removing of item only needed for local data portal
|
{
|
||||||
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("EntryInfo.DataPortal_Fetch", ex);
|
||||||
ApplicationContext.LocalContext.Remove("cn");
|
_ErrorMessage = ex.Message;
|
||||||
}
|
throw new DbCslaException("EntryInfo.DataPortal_Fetch", ex);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
}
|
||||||
{
|
#endregion
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("EntryInfo.DataPortal_Fetch", ex);
|
// Standard Refresh
|
||||||
_ErrorMessage = ex.Message;
|
#region extension
|
||||||
throw new DbCslaException("EntryInfo.DataPortal_Fetch", ex);
|
EntryInfoExtension _EntryInfoExtension = new EntryInfoExtension();
|
||||||
}
|
[Serializable()]
|
||||||
}
|
partial class EntryInfoExtension : extensionBase { }
|
||||||
#endregion
|
[Serializable()]
|
||||||
// Standard Refresh
|
class extensionBase
|
||||||
#region extension
|
{
|
||||||
EntryInfoExtension _EntryInfoExtension = new EntryInfoExtension();
|
// Default Refresh
|
||||||
[Serializable()]
|
public virtual void Refresh(EntryInfo tmp) { }
|
||||||
partial class EntryInfoExtension : extensionBase { }
|
}
|
||||||
[Serializable()]
|
#endregion
|
||||||
class extensionBase
|
} // Class
|
||||||
{
|
#region Converter
|
||||||
// Default Refresh
|
internal class EntryInfoConverter : ExpandableObjectConverter
|
||||||
public virtual void Refresh(EntryInfo tmp) { }
|
{
|
||||||
}
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
#endregion
|
{
|
||||||
} // Class
|
if (destType == typeof(string) && value is EntryInfo)
|
||||||
#region Converter
|
{
|
||||||
internal class EntryInfoConverter : ExpandableObjectConverter
|
// Return the ToString value
|
||||||
{
|
return ((EntryInfo)value).ToString();
|
||||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
}
|
||||||
{
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
if (destType == typeof(string) && value is EntryInfo)
|
}
|
||||||
{
|
}
|
||||||
// Return the ToString value
|
#endregion
|
||||||
return ((EntryInfo)value).ToString();
|
|
||||||
}
|
|
||||||
return base.ConvertTo(context, culture, value, destType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -19,446 +19,437 @@ using System.ComponentModel;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
public delegate void FigureInfoEvent(object sender);
|
public delegate void FigureInfoEvent(object sender);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// FigureInfo Generated by MyGeneration using the CSLA Object Mapping template
|
/// FigureInfo Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
[TypeConverter(typeof(FigureInfoConverter))]
|
[TypeConverter(typeof(FigureInfoConverter))]
|
||||||
public partial class FigureInfo : ReadOnlyBase<FigureInfo>, IDisposable
|
public partial class FigureInfo : ReadOnlyBase<FigureInfo>, IDisposable
|
||||||
{
|
{
|
||||||
public event FigureInfoEvent Changed;
|
public event FigureInfoEvent Changed;
|
||||||
private void OnChange()
|
private void OnChange()
|
||||||
{
|
{
|
||||||
if (Changed != null) Changed(this);
|
if (Changed != null) Changed(this);
|
||||||
}
|
}
|
||||||
#region Log4Net
|
#region Log4Net
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
private static List<FigureInfo> _CacheList = new List<FigureInfo>();
|
private static List<FigureInfo> _CacheList = new List<FigureInfo>();
|
||||||
protected static void AddToCache(FigureInfo figureInfo)
|
protected static void AddToCache(FigureInfo figureInfo)
|
||||||
{
|
{
|
||||||
if (!_CacheList.Contains(figureInfo)) _CacheList.Add(figureInfo); // In AddToCache
|
if (!_CacheList.Contains(figureInfo)) _CacheList.Add(figureInfo); // In AddToCache
|
||||||
}
|
}
|
||||||
protected static void RemoveFromCache(FigureInfo figureInfo)
|
protected static void RemoveFromCache(FigureInfo figureInfo)
|
||||||
{
|
{
|
||||||
while (_CacheList.Contains(figureInfo)) _CacheList.Remove(figureInfo); // In RemoveFromCache
|
while (_CacheList.Contains(figureInfo)) _CacheList.Remove(figureInfo); // In RemoveFromCache
|
||||||
}
|
}
|
||||||
private static Dictionary<string, List<FigureInfo>> _CacheByPrimaryKey = new Dictionary<string, List<FigureInfo>>();
|
private static Dictionary<string, List<FigureInfo>> _CacheByPrimaryKey = new Dictionary<string, List<FigureInfo>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
while (_CacheList.Count > 0) // Move FigureInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
while (_CacheList.Count > 0) // Move FigureInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
||||||
{
|
{
|
||||||
FigureInfo tmp = _CacheList[0]; // Get the first FigureInfo
|
FigureInfo tmp = _CacheList[0]; // Get the first FigureInfo
|
||||||
string pKey = tmp.FigureID.ToString();
|
string pKey = tmp.FigureID.ToString();
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
||||||
{
|
{
|
||||||
_CacheByPrimaryKey[pKey] = new List<FigureInfo>(); // Add new list for PrimaryKey
|
_CacheByPrimaryKey[pKey] = new List<FigureInfo>(); // Add new list for PrimaryKey
|
||||||
}
|
}
|
||||||
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
||||||
_CacheList.RemoveAt(0); // Remove the first FigureInfo
|
_CacheList.RemoveAt(0); // Remove the first FigureInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
internal static void AddList(FigureInfoList lst)
|
internal static void AddList(FigureInfoList lst)
|
||||||
{
|
{
|
||||||
foreach (FigureInfo item in lst) AddToCache(item);
|
foreach (FigureInfo item in lst) AddToCache(item);
|
||||||
}
|
}
|
||||||
protected static FigureInfo GetCachedByPrimaryKey(int figureID)
|
protected static FigureInfo GetCachedByPrimaryKey(int figureID)
|
||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = figureID.ToString();
|
string key = figureID.ToString();
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Business Methods
|
#region Business Methods
|
||||||
private string _ErrorMessage = string.Empty;
|
private string _ErrorMessage = string.Empty;
|
||||||
public string ErrorMessage
|
public string ErrorMessage
|
||||||
{
|
{
|
||||||
get { return _ErrorMessage; }
|
get { return _ErrorMessage; }
|
||||||
}
|
}
|
||||||
protected Figure _Editable;
|
protected Figure _Editable;
|
||||||
private IVEHasBrokenRules HasBrokenRules
|
private IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
IVEHasBrokenRules hasBrokenRules = null;
|
IVEHasBrokenRules hasBrokenRules = null;
|
||||||
if (_Editable != null)
|
if (_Editable != null)
|
||||||
hasBrokenRules = _Editable.HasBrokenRules;
|
hasBrokenRules = _Editable.HasBrokenRules;
|
||||||
return hasBrokenRules;
|
return hasBrokenRules;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private int _FigureID;
|
private int _FigureID;
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
public int FigureID
|
public int FigureID
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("FigureID", true);
|
return _FigureID;
|
||||||
return _FigureID;
|
}
|
||||||
}
|
}
|
||||||
}
|
private int _ROFstID;
|
||||||
private int _ROFstID;
|
public int ROFstID
|
||||||
public int ROFstID
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
get
|
||||||
get
|
{
|
||||||
{
|
if (_MyROFst != null) _ROFstID = _MyROFst.ROFstID;
|
||||||
CanReadProperty("ROFstID", true);
|
return _ROFstID;
|
||||||
if (_MyROFst != null) _ROFstID = _MyROFst.ROFstID;
|
}
|
||||||
return _ROFstID;
|
}
|
||||||
}
|
private ROFstInfo _MyROFst;
|
||||||
}
|
public ROFstInfo MyROFst
|
||||||
private ROFstInfo _MyROFst;
|
{
|
||||||
public ROFstInfo MyROFst
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
if (_MyROFst == null && _ROFstID != 0) _MyROFst = ROFstInfo.Get(_ROFstID);
|
||||||
{
|
return _MyROFst;
|
||||||
CanReadProperty("MyROFst", true);
|
}
|
||||||
if (_MyROFst == null && _ROFstID != 0) _MyROFst = ROFstInfo.Get(_ROFstID);
|
}
|
||||||
return _MyROFst;
|
private int _ImageID;
|
||||||
}
|
public int ImageID
|
||||||
}
|
{
|
||||||
private int _ImageID;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
public int ImageID
|
get
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
if (_MyROImage != null) _ImageID = _MyROImage.ImageID;
|
||||||
get
|
return _ImageID;
|
||||||
{
|
}
|
||||||
CanReadProperty("ImageID", true);
|
}
|
||||||
if (_MyROImage != null) _ImageID = _MyROImage.ImageID;
|
private ROImageInfo _MyROImage;
|
||||||
return _ImageID;
|
public ROImageInfo MyROImage
|
||||||
}
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
private ROImageInfo _MyROImage;
|
get
|
||||||
public ROImageInfo MyROImage
|
{
|
||||||
{
|
if (_MyROImage == null && _ImageID != 0) _MyROImage = ROImageInfo.Get(_ImageID);
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
return _MyROImage;
|
||||||
get
|
}
|
||||||
{
|
}
|
||||||
CanReadProperty("MyROImage", true);
|
private string _Config = string.Empty;
|
||||||
if (_MyROImage == null && _ImageID != 0) _MyROImage = ROImageInfo.Get(_ImageID);
|
public string Config
|
||||||
return _MyROImage;
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
private string _Config = string.Empty;
|
{
|
||||||
public string Config
|
return _Config;
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
private DateTime _DTS = new DateTime();
|
||||||
{
|
public DateTime DTS
|
||||||
CanReadProperty("Config", true);
|
{
|
||||||
return _Config;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
}
|
{
|
||||||
private DateTime _DTS = new DateTime();
|
return _DTS;
|
||||||
public DateTime DTS
|
}
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
private string _UserID = string.Empty;
|
||||||
get
|
public string UserID
|
||||||
{
|
{
|
||||||
CanReadProperty("DTS", true);
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
return _DTS;
|
get
|
||||||
}
|
{
|
||||||
}
|
return _UserID;
|
||||||
private string _UserID = string.Empty;
|
}
|
||||||
public string UserID
|
}
|
||||||
{
|
// CSLATODO: Replace base FigureInfo.ToString function as necessary
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
/// <summary>
|
||||||
get
|
/// Overrides Base ToString
|
||||||
{
|
/// </summary>
|
||||||
CanReadProperty("UserID", true);
|
/// <returns>A string representation of current FigureInfo</returns>
|
||||||
return _UserID;
|
//public override string ToString()
|
||||||
}
|
//{
|
||||||
}
|
// return base.ToString();
|
||||||
// CSLATODO: Replace base FigureInfo.ToString function as necessary
|
//}
|
||||||
/// <summary>
|
// CSLATODO: Check FigureInfo.GetIdValue to assure that the ID returned is unique
|
||||||
/// Overrides Base ToString
|
/// <summary>
|
||||||
/// </summary>
|
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||||
/// <returns>A string representation of current FigureInfo</returns>
|
/// </summary>
|
||||||
//public override string ToString()
|
/// <returns>A Unique ID for the current FigureInfo</returns>
|
||||||
//{
|
protected override object GetIdValue()
|
||||||
// return base.ToString();
|
{
|
||||||
//}
|
return MyFigureInfoUnique; // Absolutely Unique ID
|
||||||
// CSLATODO: Check FigureInfo.GetIdValue to assure that the ID returned is unique
|
}
|
||||||
/// <summary>
|
#endregion
|
||||||
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
#region Factory Methods
|
||||||
/// </summary>
|
private static int _FigureInfoUnique = 0;
|
||||||
/// <returns>A Unique ID for the current FigureInfo</returns>
|
private static int FigureInfoUnique
|
||||||
protected override object GetIdValue()
|
{ get { return ++_FigureInfoUnique; } }
|
||||||
{
|
private int _MyFigureInfoUnique = FigureInfoUnique;
|
||||||
return MyFigureInfoUnique; // Absolutely Unique ID
|
public int MyFigureInfoUnique // Absolutely Unique ID - Info
|
||||||
}
|
{ get { return _MyFigureInfoUnique; } }
|
||||||
#endregion
|
protected FigureInfo()
|
||||||
#region Factory Methods
|
{/* require use of factory methods */
|
||||||
private static int _FigureInfoUnique = 0;
|
AddToCache(this);
|
||||||
private static int FigureInfoUnique
|
}
|
||||||
{ get { return ++_FigureInfoUnique; } }
|
private bool _Disposed = false;
|
||||||
private int _MyFigureInfoUnique = FigureInfoUnique;
|
private static int _CountCreated = 0;
|
||||||
public int MyFigureInfoUnique // Absolutely Unique ID - Info
|
private static int _CountDisposed = 0;
|
||||||
{ get { return _MyFigureInfoUnique; } }
|
private static int _CountFinalized = 0;
|
||||||
protected FigureInfo()
|
private static int IncrementCountCreated
|
||||||
{/* require use of factory methods */
|
{ get { return ++_CountCreated; } }
|
||||||
AddToCache(this);
|
private int _CountWhenCreated = IncrementCountCreated;
|
||||||
}
|
public static int CountCreated
|
||||||
private bool _Disposed = false;
|
{ get { return _CountCreated; } }
|
||||||
private static int _CountCreated = 0;
|
public static int CountNotDisposed
|
||||||
private static int _CountDisposed = 0;
|
{ get { return _CountCreated - _CountDisposed; } }
|
||||||
private static int _CountFinalized = 0;
|
public static int CountNotFinalized
|
||||||
private static int IncrementCountCreated
|
{ get { return _CountCreated - _CountFinalized; } }
|
||||||
{ get { return ++_CountCreated; } }
|
~FigureInfo()
|
||||||
private int _CountWhenCreated = IncrementCountCreated;
|
{
|
||||||
public static int CountCreated
|
_CountFinalized++;
|
||||||
{ get { return _CountCreated; } }
|
}
|
||||||
public static int CountNotDisposed
|
public void Dispose()
|
||||||
{ get { return _CountCreated - _CountDisposed; } }
|
{
|
||||||
public static int CountNotFinalized
|
if (_Disposed) return;
|
||||||
{ get { return _CountCreated - _CountFinalized; } }
|
_CountDisposed++;
|
||||||
~FigureInfo()
|
_Disposed = true;
|
||||||
{
|
RemoveFromCache(this);
|
||||||
_CountFinalized++;
|
if (!_CacheByPrimaryKey.ContainsKey(FigureID.ToString())) return;
|
||||||
}
|
List<FigureInfo> listFigureInfo = _CacheByPrimaryKey[FigureID.ToString()]; // Get the list of items
|
||||||
public void Dispose()
|
while (listFigureInfo.Contains(this)) listFigureInfo.Remove(this); // Remove the item from the list
|
||||||
{
|
if (listFigureInfo.Count == 0) // If there are no items left in the list
|
||||||
if (_Disposed) return;
|
_CacheByPrimaryKey.Remove(FigureID.ToString()); // remove the list
|
||||||
_CountDisposed++;
|
}
|
||||||
_Disposed = true;
|
public virtual Figure Get()
|
||||||
RemoveFromCache(this);
|
{
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(FigureID.ToString())) return;
|
return _Editable = Figure.Get(_FigureID);
|
||||||
List<FigureInfo> listFigureInfo = _CacheByPrimaryKey[FigureID.ToString()]; // Get the list of items
|
}
|
||||||
while (listFigureInfo.Contains(this)) listFigureInfo.Remove(this); // Remove the item from the list
|
public static void Refresh(Figure tmp)
|
||||||
if (listFigureInfo.Count == 0) // If there are no items left in the list
|
{
|
||||||
_CacheByPrimaryKey.Remove(FigureID.ToString()); // remove the list
|
string key = tmp.FigureID.ToString();
|
||||||
}
|
ConvertListToDictionary();
|
||||||
public virtual Figure Get()
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
{
|
foreach (FigureInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
return _Editable = Figure.Get(_FigureID);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
public static void Refresh(Figure tmp)
|
protected virtual void RefreshFields(Figure tmp)
|
||||||
{
|
{
|
||||||
string key = tmp.FigureID.ToString();
|
if (_ROFstID != tmp.ROFstID)
|
||||||
ConvertListToDictionary();
|
{
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
if (MyROFst != null) MyROFst.RefreshROFstFigures(); // Update List for old value
|
||||||
foreach (FigureInfo tmpInfo in _CacheByPrimaryKey[key])
|
_ROFstID = tmp.ROFstID; // Update the value
|
||||||
tmpInfo.RefreshFields(tmp);
|
}
|
||||||
}
|
_MyROFst = null; // Reset list so that the next line gets a new list
|
||||||
protected virtual void RefreshFields(Figure tmp)
|
if (MyROFst != null) MyROFst.RefreshROFstFigures(); // Update List for new value
|
||||||
{
|
if (_ImageID != tmp.ImageID)
|
||||||
if (_ROFstID != tmp.ROFstID)
|
{
|
||||||
{
|
if (MyROImage != null) MyROImage.RefreshROImageFigures(); // Update List for old value
|
||||||
if (MyROFst != null) MyROFst.RefreshROFstFigures(); // Update List for old value
|
_ImageID = tmp.ImageID; // Update the value
|
||||||
_ROFstID = tmp.ROFstID; // Update the value
|
}
|
||||||
}
|
_MyROImage = null; // Reset list so that the next line gets a new list
|
||||||
_MyROFst = null; // Reset list so that the next line gets a new list
|
if (MyROImage != null) MyROImage.RefreshROImageFigures(); // Update List for new value
|
||||||
if (MyROFst != null) MyROFst.RefreshROFstFigures(); // Update List for new value
|
_Config = tmp.Config;
|
||||||
if (_ImageID != tmp.ImageID)
|
_DTS = tmp.DTS;
|
||||||
{
|
_UserID = tmp.UserID;
|
||||||
if (MyROImage != null) MyROImage.RefreshROImageFigures(); // Update List for old value
|
_FigureInfoExtension.Refresh(this);
|
||||||
_ImageID = tmp.ImageID; // Update the value
|
OnChange();// raise an event
|
||||||
}
|
}
|
||||||
_MyROImage = null; // Reset list so that the next line gets a new list
|
public static void Refresh(ROFstFigure tmp)
|
||||||
if (MyROImage != null) MyROImage.RefreshROImageFigures(); // Update List for new value
|
{
|
||||||
_Config = tmp.Config;
|
string key = tmp.FigureID.ToString();
|
||||||
_DTS = tmp.DTS;
|
ConvertListToDictionary();
|
||||||
_UserID = tmp.UserID;
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
_FigureInfoExtension.Refresh(this);
|
foreach (FigureInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
OnChange();// raise an event
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
public static void Refresh(ROFstFigure tmp)
|
protected virtual void RefreshFields(ROFstFigure tmp)
|
||||||
{
|
{
|
||||||
string key = tmp.FigureID.ToString();
|
if (_ImageID != tmp.ImageID)
|
||||||
ConvertListToDictionary();
|
{
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
if (MyROImage != null) MyROImage.RefreshROImageFigures(); // Update List for old value
|
||||||
foreach (FigureInfo tmpInfo in _CacheByPrimaryKey[key])
|
_ImageID = tmp.ImageID; // Update the value
|
||||||
tmpInfo.RefreshFields(tmp);
|
}
|
||||||
}
|
_MyROImage = null; // Reset list so that the next line gets a new list
|
||||||
protected virtual void RefreshFields(ROFstFigure tmp)
|
if (MyROImage != null) MyROImage.RefreshROImageFigures(); // Update List for new value
|
||||||
{
|
_Config = tmp.Config;
|
||||||
if (_ImageID != tmp.ImageID)
|
_DTS = tmp.DTS;
|
||||||
{
|
_UserID = tmp.UserID;
|
||||||
if (MyROImage != null) MyROImage.RefreshROImageFigures(); // Update List for old value
|
_FigureInfoExtension.Refresh(this);
|
||||||
_ImageID = tmp.ImageID; // Update the value
|
OnChange();// raise an event
|
||||||
}
|
}
|
||||||
_MyROImage = null; // Reset list so that the next line gets a new list
|
public static void Refresh(ROImageFigure tmp)
|
||||||
if (MyROImage != null) MyROImage.RefreshROImageFigures(); // Update List for new value
|
{
|
||||||
_Config = tmp.Config;
|
string key = tmp.FigureID.ToString();
|
||||||
_DTS = tmp.DTS;
|
ConvertListToDictionary();
|
||||||
_UserID = tmp.UserID;
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
_FigureInfoExtension.Refresh(this);
|
foreach (FigureInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
OnChange();// raise an event
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
public static void Refresh(ROImageFigure tmp)
|
protected virtual void RefreshFields(ROImageFigure tmp)
|
||||||
{
|
{
|
||||||
string key = tmp.FigureID.ToString();
|
if (_ROFstID != tmp.ROFstID)
|
||||||
ConvertListToDictionary();
|
{
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
if (MyROFst != null) MyROFst.RefreshROFstFigures(); // Update List for old value
|
||||||
foreach (FigureInfo tmpInfo in _CacheByPrimaryKey[key])
|
_ROFstID = tmp.ROFstID; // Update the value
|
||||||
tmpInfo.RefreshFields(tmp);
|
}
|
||||||
}
|
_MyROFst = null; // Reset list so that the next line gets a new list
|
||||||
protected virtual void RefreshFields(ROImageFigure tmp)
|
if (MyROFst != null) MyROFst.RefreshROFstFigures(); // Update List for new value
|
||||||
{
|
_Config = tmp.Config;
|
||||||
if (_ROFstID != tmp.ROFstID)
|
_DTS = tmp.DTS;
|
||||||
{
|
_UserID = tmp.UserID;
|
||||||
if (MyROFst != null) MyROFst.RefreshROFstFigures(); // Update List for old value
|
_FigureInfoExtension.Refresh(this);
|
||||||
_ROFstID = tmp.ROFstID; // Update the value
|
OnChange();// raise an event
|
||||||
}
|
}
|
||||||
_MyROFst = null; // Reset list so that the next line gets a new list
|
public static FigureInfo Get(int figureID)
|
||||||
if (MyROFst != null) MyROFst.RefreshROFstFigures(); // Update List for new value
|
{
|
||||||
_Config = tmp.Config;
|
//if (!CanGetObject())
|
||||||
_DTS = tmp.DTS;
|
// throw new System.Security.SecurityException("User not authorized to view a Figure");
|
||||||
_UserID = tmp.UserID;
|
try
|
||||||
_FigureInfoExtension.Refresh(this);
|
{
|
||||||
OnChange();// raise an event
|
FigureInfo tmp = GetCachedByPrimaryKey(figureID);
|
||||||
}
|
if (tmp == null)
|
||||||
public static FigureInfo Get(int figureID)
|
{
|
||||||
{
|
tmp = DataPortal.Fetch<FigureInfo>(new PKCriteria(figureID));
|
||||||
//if (!CanGetObject())
|
AddToCache(tmp);
|
||||||
// throw new System.Security.SecurityException("User not authorized to view a Figure");
|
}
|
||||||
try
|
if (tmp.ErrorMessage == "No Record Found")
|
||||||
{
|
{
|
||||||
FigureInfo tmp = GetCachedByPrimaryKey(figureID);
|
tmp.Dispose(); // Clean-up FigureInfo
|
||||||
if (tmp == null)
|
tmp = null;
|
||||||
{
|
}
|
||||||
tmp = DataPortal.Fetch<FigureInfo>(new PKCriteria(figureID));
|
return tmp;
|
||||||
AddToCache(tmp);
|
}
|
||||||
}
|
catch (Exception ex)
|
||||||
if (tmp.ErrorMessage == "No Record Found")
|
{
|
||||||
{
|
throw new DbCslaException("Error on FigureInfo.Get", ex);
|
||||||
tmp.Dispose(); // Clean-up FigureInfo
|
}
|
||||||
tmp = null;
|
}
|
||||||
}
|
#endregion
|
||||||
return tmp;
|
#region Data Access Portal
|
||||||
}
|
internal FigureInfo(SafeDataReader dr)
|
||||||
catch (Exception ex)
|
{
|
||||||
{
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FigureInfo.Constructor", GetHashCode());
|
||||||
throw new DbCslaException("Error on FigureInfo.Get", ex);
|
try
|
||||||
}
|
{
|
||||||
}
|
ReadData(dr);
|
||||||
#endregion
|
}
|
||||||
#region Data Access Portal
|
catch (Exception ex)
|
||||||
internal FigureInfo(SafeDataReader dr)
|
{
|
||||||
{
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("FigureInfo.Constructor", ex);
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FigureInfo.Constructor", GetHashCode());
|
throw new DbCslaException("FigureInfo.Constructor", ex);
|
||||||
try
|
}
|
||||||
{
|
}
|
||||||
ReadData(dr);
|
[Serializable()]
|
||||||
}
|
protected class PKCriteria
|
||||||
catch (Exception ex)
|
{
|
||||||
{
|
private int _FigureID;
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("FigureInfo.Constructor", ex);
|
public int FigureID
|
||||||
throw new DbCslaException("FigureInfo.Constructor", ex);
|
{ get { return _FigureID; } }
|
||||||
}
|
public PKCriteria(int figureID)
|
||||||
}
|
{
|
||||||
[Serializable()]
|
_FigureID = figureID;
|
||||||
protected class PKCriteria
|
}
|
||||||
{
|
}
|
||||||
private int _FigureID;
|
private string _ROImage_FileName = string.Empty;
|
||||||
public int FigureID
|
public string ROImage_FileName
|
||||||
{ get { return _FigureID; } }
|
{
|
||||||
public PKCriteria(int figureID)
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
_FigureID = figureID;
|
{
|
||||||
}
|
return _ROImage_FileName;
|
||||||
}
|
}
|
||||||
private string _ROImage_FileName = string.Empty;
|
}
|
||||||
public string ROImage_FileName
|
private void ReadData(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FigureInfo.ReadData", GetHashCode());
|
||||||
get
|
try
|
||||||
{
|
{
|
||||||
CanReadProperty("ROImage_FileName", true);
|
_FigureID = dr.GetInt32("FigureID");
|
||||||
return _ROImage_FileName;
|
_ROFstID = dr.GetInt32("ROFstID");
|
||||||
}
|
_ImageID = dr.GetInt32("ImageID");
|
||||||
}
|
_Config = dr.GetString("Config");
|
||||||
private void ReadData(SafeDataReader dr)
|
_DTS = dr.GetDateTime("DTS");
|
||||||
{
|
_UserID = dr.GetString("UserID");
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FigureInfo.ReadData", GetHashCode());
|
for (int i = 0; i < dr.FieldCount; i++)
|
||||||
try
|
{
|
||||||
{
|
if (dr.GetName(i) == "ROImage_FileName")
|
||||||
_FigureID = dr.GetInt32("FigureID");
|
_ROImage_FileName = dr.GetString("ROImage_FileName");
|
||||||
_ROFstID = dr.GetInt32("ROFstID");
|
}
|
||||||
_ImageID = dr.GetInt32("ImageID");
|
}
|
||||||
_Config = dr.GetString("Config");
|
catch (Exception ex)
|
||||||
_DTS = dr.GetDateTime("DTS");
|
{
|
||||||
_UserID = dr.GetString("UserID");
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("FigureInfo.ReadData", ex);
|
||||||
for (int i = 0; i < dr.FieldCount; i++)
|
_ErrorMessage = ex.Message;
|
||||||
{
|
throw new DbCslaException("FigureInfo.ReadData", ex);
|
||||||
if (dr.GetName(i) == "ROImage_FileName")
|
}
|
||||||
_ROImage_FileName = dr.GetString("ROImage_FileName");
|
}
|
||||||
}
|
private void DataPortal_Fetch(PKCriteria criteria)
|
||||||
}
|
{
|
||||||
catch (Exception ex)
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FigureInfo.DataPortal_Fetch", GetHashCode());
|
||||||
{
|
try
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("FigureInfo.ReadData", ex);
|
{
|
||||||
_ErrorMessage = ex.Message;
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
throw new DbCslaException("FigureInfo.ReadData", ex);
|
{
|
||||||
}
|
ApplicationContext.LocalContext["cn"] = cn;
|
||||||
}
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
private void DataPortal_Fetch(PKCriteria criteria)
|
{
|
||||||
{
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FigureInfo.DataPortal_Fetch", GetHashCode());
|
cm.CommandText = "getFigure";
|
||||||
try
|
cm.Parameters.AddWithValue("@FigureID", criteria.FigureID);
|
||||||
{
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
{
|
{
|
||||||
ApplicationContext.LocalContext["cn"] = cn;
|
if (!dr.Read())
|
||||||
using (SqlCommand cm = cn.CreateCommand())
|
{
|
||||||
{
|
_ErrorMessage = "No Record Found";
|
||||||
cm.CommandType = CommandType.StoredProcedure;
|
return;
|
||||||
cm.CommandText = "getFigure";
|
}
|
||||||
cm.Parameters.AddWithValue("@FigureID", criteria.FigureID);
|
ReadData(dr);
|
||||||
cm.CommandTimeout = Database.DefaultTimeout;
|
}
|
||||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
}
|
||||||
{
|
// removing of item only needed for local data portal
|
||||||
if (!dr.Read())
|
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
||||||
{
|
ApplicationContext.LocalContext.Remove("cn");
|
||||||
_ErrorMessage = "No Record Found";
|
}
|
||||||
return;
|
}
|
||||||
}
|
catch (Exception ex)
|
||||||
ReadData(dr);
|
{
|
||||||
}
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("FigureInfo.DataPortal_Fetch", ex);
|
||||||
}
|
_ErrorMessage = ex.Message;
|
||||||
// removing of item only needed for local data portal
|
throw new DbCslaException("FigureInfo.DataPortal_Fetch", ex);
|
||||||
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
}
|
||||||
ApplicationContext.LocalContext.Remove("cn");
|
}
|
||||||
}
|
#endregion
|
||||||
}
|
// Standard Refresh
|
||||||
catch (Exception ex)
|
#region extension
|
||||||
{
|
FigureInfoExtension _FigureInfoExtension = new FigureInfoExtension();
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("FigureInfo.DataPortal_Fetch", ex);
|
[Serializable()]
|
||||||
_ErrorMessage = ex.Message;
|
partial class FigureInfoExtension : extensionBase { }
|
||||||
throw new DbCslaException("FigureInfo.DataPortal_Fetch", ex);
|
[Serializable()]
|
||||||
}
|
class extensionBase
|
||||||
}
|
{
|
||||||
#endregion
|
// Default Refresh
|
||||||
// Standard Refresh
|
public virtual void Refresh(FigureInfo tmp) { }
|
||||||
#region extension
|
}
|
||||||
FigureInfoExtension _FigureInfoExtension = new FigureInfoExtension();
|
#endregion
|
||||||
[Serializable()]
|
} // Class
|
||||||
partial class FigureInfoExtension : extensionBase { }
|
#region Converter
|
||||||
[Serializable()]
|
internal class FigureInfoConverter : ExpandableObjectConverter
|
||||||
class extensionBase
|
{
|
||||||
{
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
// Default Refresh
|
{
|
||||||
public virtual void Refresh(FigureInfo tmp) { }
|
if (destType == typeof(string) && value is FigureInfo)
|
||||||
}
|
{
|
||||||
#endregion
|
// Return the ToString value
|
||||||
} // Class
|
return ((FigureInfo)value).ToString();
|
||||||
#region Converter
|
}
|
||||||
internal class FigureInfoConverter : ExpandableObjectConverter
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
{
|
}
|
||||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
}
|
||||||
{
|
#endregion
|
||||||
if (destType == typeof(string) && value is FigureInfo)
|
|
||||||
{
|
|
||||||
// Return the ToString value
|
|
||||||
return ((FigureInfo)value).ToString();
|
|
||||||
}
|
|
||||||
return base.ConvertTo(context, culture, value, destType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -20,476 +20,462 @@ using System.Collections.Generic;
|
|||||||
using Csla.Validation;
|
using Csla.Validation;
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// FormatContent Generated by MyGeneration using the CSLA Object Mapping template
|
/// FormatContent Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
[TypeConverter(typeof(FormatContentConverter))]
|
[TypeConverter(typeof(FormatContentConverter))]
|
||||||
public partial class FormatContent : BusinessBase<FormatContent>, IVEHasBrokenRules, IDisposable
|
public partial class FormatContent : BusinessBase<FormatContent>, IVEHasBrokenRules, IDisposable
|
||||||
{
|
{
|
||||||
#region Log4Net
|
#region Log4Net
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#endregion
|
#endregion
|
||||||
#region Business Methods
|
#region Business Methods
|
||||||
private string _ErrorMessage = string.Empty;
|
private string _ErrorMessage = string.Empty;
|
||||||
public string ErrorMessage
|
public string ErrorMessage
|
||||||
{
|
{
|
||||||
get { return _ErrorMessage; }
|
get { return _ErrorMessage; }
|
||||||
}
|
}
|
||||||
private int _ContentID;
|
private int _ContentID;
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
public int ContentID
|
public int ContentID
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("ContentID", true);
|
if (_MyContent != null) _ContentID = _MyContent.ContentID;
|
||||||
if (_MyContent != null) _ContentID = _MyContent.ContentID;
|
return _ContentID;
|
||||||
return _ContentID;
|
}
|
||||||
}
|
}
|
||||||
}
|
private Content _MyContent;
|
||||||
private Content _MyContent;
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
public Content MyContent
|
||||||
public Content MyContent
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
get
|
||||||
get
|
{
|
||||||
{
|
if (_MyContent == null && _ContentID != 0) _MyContent = Content.Get(_ContentID);
|
||||||
CanReadProperty("MyContent", true);
|
return _MyContent;
|
||||||
if (_MyContent == null && _ContentID != 0) _MyContent = Content.Get(_ContentID);
|
}
|
||||||
return _MyContent;
|
}
|
||||||
}
|
private string _Number = string.Empty;
|
||||||
}
|
/// <summary>
|
||||||
private string _Number = string.Empty;
|
/// Increased from 30 to 256 to support RTF symbols
|
||||||
/// <summary>
|
/// </summary>
|
||||||
/// Increased from 30 to 256 to support RTF symbols
|
public string Number
|
||||||
/// </summary>
|
{
|
||||||
public string Number
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
return _Number;
|
||||||
{
|
}
|
||||||
CanReadProperty("Number", true);
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
return _Number;
|
set
|
||||||
}
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
if (value == null) value = string.Empty;
|
||||||
set
|
if (_Number != value)
|
||||||
{
|
{
|
||||||
CanWriteProperty("Number", true);
|
_Number = value;
|
||||||
if (value == null) value = string.Empty;
|
PropertyHasChanged();
|
||||||
if (_Number != value)
|
}
|
||||||
{
|
}
|
||||||
_Number = value;
|
}
|
||||||
PropertyHasChanged();
|
private string _Text = string.Empty;
|
||||||
}
|
public string Text
|
||||||
}
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
private string _Text = string.Empty;
|
get
|
||||||
public string Text
|
{
|
||||||
{
|
return _Text;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
set
|
||||||
CanReadProperty("Text", true);
|
{
|
||||||
return _Text;
|
if (value == null) value = string.Empty;
|
||||||
}
|
if (_Text != value)
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
set
|
_Text = value;
|
||||||
{
|
PropertyHasChanged();
|
||||||
CanWriteProperty("Text", true);
|
}
|
||||||
if (value == null) value = string.Empty;
|
}
|
||||||
if (_Text != value)
|
}
|
||||||
{
|
private int? _Type;
|
||||||
_Text = value;
|
/// <summary>
|
||||||
PropertyHasChanged();
|
/// 0 - Procedure, 10000 - Section, 20000 Step
|
||||||
}
|
/// </summary>
|
||||||
}
|
public int? Type
|
||||||
}
|
{
|
||||||
private int? _Type;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
/// <summary>
|
get
|
||||||
/// 0 - Procedure, 10000 - Section, 20000 Step
|
{
|
||||||
/// </summary>
|
return _Type;
|
||||||
public int? Type
|
}
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
set
|
||||||
get
|
{
|
||||||
{
|
if (_Type != value)
|
||||||
CanReadProperty("Type", true);
|
{
|
||||||
return _Type;
|
_Type = value;
|
||||||
}
|
PropertyHasChanged();
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
set
|
}
|
||||||
{
|
}
|
||||||
CanWriteProperty("Type", true);
|
private string _Config = string.Empty;
|
||||||
if (_Type != value)
|
public string Config
|
||||||
{
|
{
|
||||||
_Type = value;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
PropertyHasChanged();
|
get
|
||||||
}
|
{
|
||||||
}
|
return _Config;
|
||||||
}
|
}
|
||||||
private string _Config = string.Empty;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
public string Config
|
set
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
if (value == null) value = string.Empty;
|
||||||
get
|
if (_Config != value)
|
||||||
{
|
{
|
||||||
CanReadProperty("Config", true);
|
_Config = value;
|
||||||
return _Config;
|
PropertyHasChanged();
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
set
|
}
|
||||||
{
|
private DateTime _DTS = new DateTime();
|
||||||
CanWriteProperty("Config", true);
|
public DateTime DTS
|
||||||
if (value == null) value = string.Empty;
|
{
|
||||||
if (_Config != value)
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
_Config = value;
|
{
|
||||||
PropertyHasChanged();
|
return _DTS;
|
||||||
}
|
}
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
set
|
||||||
private DateTime _DTS = new DateTime();
|
{
|
||||||
public DateTime DTS
|
if (_DTS != value)
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
_DTS = value;
|
||||||
get
|
PropertyHasChanged();
|
||||||
{
|
}
|
||||||
CanReadProperty("DTS", true);
|
}
|
||||||
return _DTS;
|
}
|
||||||
}
|
private string _UserID = string.Empty;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
public string UserID
|
||||||
set
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
CanWriteProperty("DTS", true);
|
get
|
||||||
if (_DTS != value)
|
{
|
||||||
{
|
return _UserID;
|
||||||
_DTS = value;
|
}
|
||||||
PropertyHasChanged();
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
set
|
||||||
}
|
{
|
||||||
}
|
if (value == null) value = string.Empty;
|
||||||
private string _UserID = string.Empty;
|
if (_UserID != value)
|
||||||
public string UserID
|
{
|
||||||
{
|
_UserID = value;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
PropertyHasChanged();
|
||||||
get
|
}
|
||||||
{
|
}
|
||||||
CanReadProperty("UserID", true);
|
}
|
||||||
return _UserID;
|
private byte[] _LastChanged = new byte[8];//timestamp
|
||||||
}
|
// CSLATODO: Check FormatContent.GetIdValue to assure that the ID returned is unique
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
/// <summary>
|
||||||
set
|
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||||
{
|
/// </summary>
|
||||||
CanWriteProperty("UserID", true);
|
/// <returns>A Unique ID for the current FormatContent</returns>
|
||||||
if (value == null) value = string.Empty;
|
protected override object GetIdValue()
|
||||||
if (_UserID != value)
|
{
|
||||||
{
|
return MyFormatContentUnique; // Absolutely Unique ID
|
||||||
_UserID = value;
|
}
|
||||||
PropertyHasChanged();
|
// CSLATODO: Replace base FormatContent.ToString function as necessary
|
||||||
}
|
/// <summary>
|
||||||
}
|
/// Overrides Base ToString
|
||||||
}
|
/// </summary>
|
||||||
private byte[] _LastChanged = new byte[8];//timestamp
|
/// <returns>A string representation of current FormatContent</returns>
|
||||||
// CSLATODO: Check FormatContent.GetIdValue to assure that the ID returned is unique
|
//public override string ToString()
|
||||||
/// <summary>
|
//{
|
||||||
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
// return base.ToString();
|
||||||
/// </summary>
|
//}
|
||||||
/// <returns>A Unique ID for the current FormatContent</returns>
|
public override bool IsDirty
|
||||||
protected override object GetIdValue()
|
{
|
||||||
{
|
get { return base.IsDirty; }
|
||||||
return MyFormatContentUnique; // Absolutely Unique ID
|
}
|
||||||
}
|
public bool IsDirtyList(List<object> list)
|
||||||
// CSLATODO: Replace base FormatContent.ToString function as necessary
|
{
|
||||||
/// <summary>
|
return base.IsDirty;
|
||||||
/// Overrides Base ToString
|
}
|
||||||
/// </summary>
|
public override bool IsValid
|
||||||
/// <returns>A string representation of current FormatContent</returns>
|
{
|
||||||
//public override string ToString()
|
get { return (IsNew && !IsDirty) ? true : base.IsValid; }
|
||||||
//{
|
}
|
||||||
// return base.ToString();
|
public bool IsValidList(List<object> list)
|
||||||
//}
|
{
|
||||||
public override bool IsDirty
|
return (IsNew && !IsDirty) ? true : base.IsValid;
|
||||||
{
|
}
|
||||||
get { return base.IsDirty; }
|
#endregion
|
||||||
}
|
#region ValidationRules
|
||||||
public bool IsDirtyList(List<object> list)
|
[NonSerialized]
|
||||||
{
|
private bool _CheckingBrokenRules = false;
|
||||||
return base.IsDirty;
|
public IVEHasBrokenRules HasBrokenRules
|
||||||
}
|
{
|
||||||
public override bool IsValid
|
get
|
||||||
{
|
{
|
||||||
get { return (IsNew && !IsDirty) ? true : base.IsValid; }
|
if (_CheckingBrokenRules) return null;
|
||||||
}
|
if (BrokenRulesCollection.Count > 0) return this;
|
||||||
public bool IsValidList(List<object> list)
|
try
|
||||||
{
|
{
|
||||||
return (IsNew && !IsDirty) ? true : base.IsValid;
|
_CheckingBrokenRules = true;
|
||||||
}
|
IVEHasBrokenRules hasBrokenRules = null;
|
||||||
#endregion
|
return hasBrokenRules;
|
||||||
#region ValidationRules
|
}
|
||||||
[NonSerialized]
|
finally
|
||||||
private bool _CheckingBrokenRules = false;
|
{
|
||||||
public IVEHasBrokenRules HasBrokenRules
|
_CheckingBrokenRules = false;
|
||||||
{
|
}
|
||||||
get
|
}
|
||||||
{
|
}
|
||||||
if (_CheckingBrokenRules) return null;
|
public BrokenRulesCollection BrokenRules
|
||||||
if (BrokenRulesCollection.Count > 0) return this;
|
{
|
||||||
try
|
get
|
||||||
{
|
{
|
||||||
_CheckingBrokenRules = true;
|
IVEHasBrokenRules hasBrokenRules = HasBrokenRules;
|
||||||
IVEHasBrokenRules hasBrokenRules = null;
|
if (this.Equals(hasBrokenRules)) return BrokenRulesCollection;
|
||||||
return hasBrokenRules;
|
return (hasBrokenRules != null ? hasBrokenRules.BrokenRules : null);
|
||||||
}
|
}
|
||||||
finally
|
}
|
||||||
{
|
protected override void AddBusinessRules()
|
||||||
_CheckingBrokenRules = false;
|
{
|
||||||
}
|
ValidationRules.AddRule(
|
||||||
}
|
Csla.Validation.CommonRules.StringMaxLength,
|
||||||
}
|
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Number", 256));
|
||||||
public BrokenRulesCollection BrokenRules
|
ValidationRules.AddRule(
|
||||||
{
|
Csla.Validation.CommonRules.StringMaxLength,
|
||||||
get
|
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Text", 1073741823));
|
||||||
{
|
ValidationRules.AddRule(
|
||||||
IVEHasBrokenRules hasBrokenRules = HasBrokenRules;
|
Csla.Validation.CommonRules.StringMaxLength,
|
||||||
if (this.Equals(hasBrokenRules)) return BrokenRulesCollection;
|
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Config", 1073741823));
|
||||||
return (hasBrokenRules != null ? hasBrokenRules.BrokenRules : null);
|
ValidationRules.AddRule(
|
||||||
}
|
Csla.Validation.CommonRules.StringRequired, "UserID");
|
||||||
}
|
ValidationRules.AddRule(
|
||||||
protected override void AddBusinessRules()
|
Csla.Validation.CommonRules.StringMaxLength,
|
||||||
{
|
new Csla.Validation.CommonRules.MaxLengthRuleArgs("UserID", 100));
|
||||||
ValidationRules.AddRule(
|
// CSLATODO: Add other validation rules
|
||||||
Csla.Validation.CommonRules.StringMaxLength,
|
}
|
||||||
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Number", 256));
|
// Sample data comparison validation rule
|
||||||
ValidationRules.AddRule(
|
//private bool StartDateGTEndDate(object target, Csla.Validation.RuleArgs e)
|
||||||
Csla.Validation.CommonRules.StringMaxLength,
|
//{
|
||||||
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Text", 1073741823));
|
// if (_started > _ended)
|
||||||
ValidationRules.AddRule(
|
// {
|
||||||
Csla.Validation.CommonRules.StringMaxLength,
|
// e.Description = "Start date can't be after end date";
|
||||||
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Config", 1073741823));
|
// return false;
|
||||||
ValidationRules.AddRule(
|
// }
|
||||||
Csla.Validation.CommonRules.StringRequired, "UserID");
|
// else
|
||||||
ValidationRules.AddRule(
|
// return true;
|
||||||
Csla.Validation.CommonRules.StringMaxLength,
|
//}
|
||||||
new Csla.Validation.CommonRules.MaxLengthRuleArgs("UserID", 100));
|
#endregion
|
||||||
// CSLATODO: Add other validation rules
|
#region Authorization Rules
|
||||||
}
|
protected override void AddAuthorizationRules()
|
||||||
// Sample data comparison validation rule
|
{
|
||||||
//private bool StartDateGTEndDate(object target, Csla.Validation.RuleArgs e)
|
//CSLATODO: Who can read/write which fields
|
||||||
//{
|
//AuthorizationRules.AllowRead(ContentID, "<Role(s)>");
|
||||||
// if (_started > _ended)
|
//AuthorizationRules.AllowRead(Number, "<Role(s)>");
|
||||||
// {
|
//AuthorizationRules.AllowWrite(Number, "<Role(s)>");
|
||||||
// e.Description = "Start date can't be after end date";
|
//AuthorizationRules.AllowRead(Text, "<Role(s)>");
|
||||||
// return false;
|
//AuthorizationRules.AllowWrite(Text, "<Role(s)>");
|
||||||
// }
|
//AuthorizationRules.AllowRead(Type, "<Role(s)>");
|
||||||
// else
|
//AuthorizationRules.AllowWrite(Type, "<Role(s)>");
|
||||||
// return true;
|
//AuthorizationRules.AllowRead(Config, "<Role(s)>");
|
||||||
//}
|
//AuthorizationRules.AllowWrite(Config, "<Role(s)>");
|
||||||
#endregion
|
//AuthorizationRules.AllowRead(DTS, "<Role(s)>");
|
||||||
#region Authorization Rules
|
//AuthorizationRules.AllowWrite(DTS, "<Role(s)>");
|
||||||
protected override void AddAuthorizationRules()
|
//AuthorizationRules.AllowRead(UserID, "<Role(s)>");
|
||||||
{
|
//AuthorizationRules.AllowWrite(UserID, "<Role(s)>");
|
||||||
//CSLATODO: Who can read/write which fields
|
}
|
||||||
//AuthorizationRules.AllowRead(ContentID, "<Role(s)>");
|
public static bool CanAddObject()
|
||||||
//AuthorizationRules.AllowRead(Number, "<Role(s)>");
|
{
|
||||||
//AuthorizationRules.AllowWrite(Number, "<Role(s)>");
|
// CSLATODO: Can Add Authorization
|
||||||
//AuthorizationRules.AllowRead(Text, "<Role(s)>");
|
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
|
||||||
//AuthorizationRules.AllowWrite(Text, "<Role(s)>");
|
return true;
|
||||||
//AuthorizationRules.AllowRead(Type, "<Role(s)>");
|
}
|
||||||
//AuthorizationRules.AllowWrite(Type, "<Role(s)>");
|
public static bool CanGetObject()
|
||||||
//AuthorizationRules.AllowRead(Config, "<Role(s)>");
|
{
|
||||||
//AuthorizationRules.AllowWrite(Config, "<Role(s)>");
|
// CSLATODO: CanGet Authorization
|
||||||
//AuthorizationRules.AllowRead(DTS, "<Role(s)>");
|
return true;
|
||||||
//AuthorizationRules.AllowWrite(DTS, "<Role(s)>");
|
}
|
||||||
//AuthorizationRules.AllowRead(UserID, "<Role(s)>");
|
public static bool CanDeleteObject()
|
||||||
//AuthorizationRules.AllowWrite(UserID, "<Role(s)>");
|
{
|
||||||
}
|
// CSLATODO: CanDelete Authorization
|
||||||
public static bool CanAddObject()
|
//bool result = false;
|
||||||
{
|
//if (Csla.ApplicationContext.User.IsInRole("ProjectManager"))result = true;
|
||||||
// CSLATODO: Can Add Authorization
|
//if (Csla.ApplicationContext.User.IsInRole("Administrator"))result = true;
|
||||||
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
|
//return result;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public static bool CanGetObject()
|
public static bool CanEditObject()
|
||||||
{
|
{
|
||||||
// CSLATODO: CanGet Authorization
|
// CSLATODO: CanEdit Authorization
|
||||||
return true;
|
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
|
||||||
}
|
return true;
|
||||||
public static bool CanDeleteObject()
|
}
|
||||||
{
|
#endregion
|
||||||
// CSLATODO: CanDelete Authorization
|
#region Factory Methods
|
||||||
//bool result = false;
|
public int CurrentEditLevel
|
||||||
//if (Csla.ApplicationContext.User.IsInRole("ProjectManager"))result = true;
|
{ get { return EditLevel; } }
|
||||||
//if (Csla.ApplicationContext.User.IsInRole("Administrator"))result = true;
|
private static int _FormatContentUnique = 0;
|
||||||
//return result;
|
private static int FormatContentUnique
|
||||||
return true;
|
{ get { return ++_FormatContentUnique; } }
|
||||||
}
|
private int _MyFormatContentUnique = FormatContentUnique;
|
||||||
public static bool CanEditObject()
|
public int MyFormatContentUnique // Absolutely Unique ID - Editable FK
|
||||||
{
|
{ get { return _MyFormatContentUnique; } }
|
||||||
// CSLATODO: CanEdit Authorization
|
internal static FormatContent New()
|
||||||
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
|
{
|
||||||
return true;
|
return new FormatContent();
|
||||||
}
|
}
|
||||||
#endregion
|
internal static FormatContent Get(SafeDataReader dr)
|
||||||
#region Factory Methods
|
{
|
||||||
public int CurrentEditLevel
|
return new FormatContent(dr);
|
||||||
{ get { return EditLevel; } }
|
}
|
||||||
private static int _FormatContentUnique = 0;
|
public FormatContent()
|
||||||
private static int FormatContentUnique
|
{
|
||||||
{ get { return ++_FormatContentUnique; } }
|
MarkAsChild();
|
||||||
private int _MyFormatContentUnique = FormatContentUnique;
|
_ContentID = Content.NextContentID;
|
||||||
public int MyFormatContentUnique // Absolutely Unique ID - Editable FK
|
_DTS = _FormatContentExtension.DefaultDTS;
|
||||||
{ get { return _MyFormatContentUnique; } }
|
_UserID = _FormatContentExtension.DefaultUserID;
|
||||||
internal static FormatContent New()
|
ValidationRules.CheckRules();
|
||||||
{
|
}
|
||||||
return new FormatContent();
|
internal FormatContent(SafeDataReader dr)
|
||||||
}
|
{
|
||||||
internal static FormatContent Get(SafeDataReader dr)
|
MarkAsChild();
|
||||||
{
|
Fetch(dr);
|
||||||
return new FormatContent(dr);
|
}
|
||||||
}
|
private bool _Disposed = false;
|
||||||
public FormatContent()
|
private static int _CountCreated = 0;
|
||||||
{
|
private static int _CountDisposed = 0;
|
||||||
MarkAsChild();
|
private static int _CountFinalized = 0;
|
||||||
_ContentID = Content.NextContentID;
|
private static int IncrementCountCreated
|
||||||
_DTS = _FormatContentExtension.DefaultDTS;
|
{ get { return ++_CountCreated; } }
|
||||||
_UserID = _FormatContentExtension.DefaultUserID;
|
private int _CountWhenCreated = IncrementCountCreated;
|
||||||
ValidationRules.CheckRules();
|
public static int CountCreated
|
||||||
}
|
{ get { return _CountCreated; } }
|
||||||
internal FormatContent(SafeDataReader dr)
|
public static int CountNotDisposed
|
||||||
{
|
{ get { return _CountCreated - _CountDisposed; } }
|
||||||
MarkAsChild();
|
public static int CountNotFinalized
|
||||||
Fetch(dr);
|
{ get { return _CountCreated - _CountFinalized; } }
|
||||||
}
|
~FormatContent()
|
||||||
private bool _Disposed = false;
|
{
|
||||||
private static int _CountCreated = 0;
|
_CountFinalized++;
|
||||||
private static int _CountDisposed = 0;
|
}
|
||||||
private static int _CountFinalized = 0;
|
public void Dispose()
|
||||||
private static int IncrementCountCreated
|
{
|
||||||
{ get { return ++_CountCreated; } }
|
if (_Disposed) return;
|
||||||
private int _CountWhenCreated = IncrementCountCreated;
|
_CountDisposed++;
|
||||||
public static int CountCreated
|
_Disposed = true;
|
||||||
{ get { return _CountCreated; } }
|
}
|
||||||
public static int CountNotDisposed
|
#endregion
|
||||||
{ get { return _CountCreated - _CountDisposed; } }
|
#region Data Access Portal
|
||||||
public static int CountNotFinalized
|
private void Fetch(SafeDataReader dr)
|
||||||
{ get { return _CountCreated - _CountFinalized; } }
|
{
|
||||||
~FormatContent()
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FormatContent.FetchDR", GetHashCode());
|
||||||
{
|
try
|
||||||
_CountFinalized++;
|
{
|
||||||
}
|
_ContentID = dr.GetInt32("ContentID");
|
||||||
public void Dispose()
|
_Number = dr.GetString("Number");
|
||||||
{
|
_Text = dr.GetString("Text");
|
||||||
if (_Disposed) return;
|
_Type = (int?)dr.GetValue("Type");
|
||||||
_CountDisposed++;
|
_Config = dr.GetString("Config");
|
||||||
_Disposed = true;
|
_DTS = dr.GetDateTime("DTS");
|
||||||
}
|
_UserID = dr.GetString("UserID");
|
||||||
#endregion
|
dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
|
||||||
#region Data Access Portal
|
}
|
||||||
private void Fetch(SafeDataReader dr)
|
catch (Exception ex) // FKItem Fetch
|
||||||
{
|
{
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FormatContent.FetchDR", GetHashCode());
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("FormatContent.FetchDR", ex);
|
||||||
try
|
throw new DbCslaException("FormatContent.Fetch", ex);
|
||||||
{
|
}
|
||||||
_ContentID = dr.GetInt32("ContentID");
|
MarkOld();
|
||||||
_Number = dr.GetString("Number");
|
}
|
||||||
_Text = dr.GetString("Text");
|
internal void Insert(Format myFormat)
|
||||||
_Type = (int?)dr.GetValue("Type");
|
{
|
||||||
_Config = dr.GetString("Config");
|
// if we're not dirty then don't update the database
|
||||||
_DTS = dr.GetDateTime("DTS");
|
if (!this.IsDirty) return;
|
||||||
_UserID = dr.GetString("UserID");
|
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||||
dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
|
_LastChanged = Content.Add(cn, ref _ContentID, _Number, _Text, _Type, myFormat, _Config, _DTS, _UserID);
|
||||||
}
|
MarkOld();
|
||||||
catch (Exception ex) // FKItem Fetch
|
}
|
||||||
{
|
internal void Update(Format myFormat)
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("FormatContent.FetchDR", ex);
|
{
|
||||||
throw new DbCslaException("FormatContent.Fetch", ex);
|
// if we're not dirty then don't update the database
|
||||||
}
|
if (!this.IsDirty) return;
|
||||||
MarkOld();
|
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||||
}
|
_LastChanged = Content.Update(cn, ref _ContentID, _Number, _Text, _Type, myFormat != null ? (int?)myFormat.FormatID : (int?)null, _Config, _DTS, _UserID, ref _LastChanged);
|
||||||
internal void Insert(Format myFormat)
|
MarkOld();
|
||||||
{
|
}
|
||||||
// if we're not dirty then don't update the database
|
internal void DeleteSelf(Format myFormat)
|
||||||
if (!this.IsDirty) return;
|
{
|
||||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
// if we're not dirty then don't update the database
|
||||||
_LastChanged = Content.Add(cn, ref _ContentID, _Number, _Text, _Type, myFormat, _Config, _DTS, _UserID);
|
if (!this.IsDirty) return;
|
||||||
MarkOld();
|
// if we're new then don't update the database
|
||||||
}
|
if (this.IsNew) return;
|
||||||
internal void Update(Format myFormat)
|
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||||
{
|
Content.Remove(cn, _ContentID);
|
||||||
// if we're not dirty then don't update the database
|
MarkNew();
|
||||||
if (!this.IsDirty) return;
|
}
|
||||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
#endregion
|
||||||
_LastChanged = Content.Update(cn, ref _ContentID, _Number, _Text, _Type, myFormat != null ? (int?) myFormat.FormatID : (int?) null, _Config, _DTS, _UserID, ref _LastChanged);
|
// Standard Default Code
|
||||||
MarkOld();
|
#region extension
|
||||||
}
|
FormatContentExtension _FormatContentExtension = new FormatContentExtension();
|
||||||
internal void DeleteSelf(Format myFormat)
|
[Serializable()]
|
||||||
{
|
partial class FormatContentExtension : extensionBase
|
||||||
// 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
|
[Serializable()]
|
||||||
if (this.IsNew) return;
|
class extensionBase
|
||||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
{
|
||||||
Content.Remove(cn, _ContentID);
|
// Default Values
|
||||||
MarkNew();
|
public virtual DateTime DefaultDTS
|
||||||
}
|
{
|
||||||
#endregion
|
get { return DateTime.Now; }
|
||||||
// Standard Default Code
|
}
|
||||||
#region extension
|
public virtual string DefaultUserID
|
||||||
FormatContentExtension _FormatContentExtension = new FormatContentExtension();
|
{
|
||||||
[Serializable()]
|
get { return Volian.Base.Library.VlnSettings.UserID; }
|
||||||
partial class FormatContentExtension : extensionBase
|
}
|
||||||
{
|
// Authorization Rules
|
||||||
}
|
public virtual void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
|
||||||
[Serializable()]
|
{
|
||||||
class extensionBase
|
// Needs to be overriden to add new authorization rules
|
||||||
{
|
}
|
||||||
// Default Values
|
// Instance Authorization Rules
|
||||||
public virtual DateTime DefaultDTS
|
public virtual void AddInstanceAuthorizationRules(Csla.Security.AuthorizationRules rules)
|
||||||
{
|
{
|
||||||
get { return DateTime.Now; }
|
// Needs to be overriden to add new authorization rules
|
||||||
}
|
}
|
||||||
public virtual string DefaultUserID
|
// Validation Rules
|
||||||
{
|
public virtual void AddValidationRules(Csla.Validation.ValidationRules rules)
|
||||||
get { return Volian.Base.Library.VlnSettings.UserID; }
|
{
|
||||||
}
|
// Needs to be overriden to add new validation rules
|
||||||
// Authorization Rules
|
}
|
||||||
public virtual void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
|
// InstanceValidation Rules
|
||||||
{
|
public virtual void AddInstanceValidationRules(Csla.Validation.ValidationRules rules)
|
||||||
// Needs to be overriden to add new authorization rules
|
{
|
||||||
}
|
// Needs to be overriden to add new validation rules
|
||||||
// Instance Authorization Rules
|
}
|
||||||
public virtual void AddInstanceAuthorizationRules(Csla.Security.AuthorizationRules rules)
|
}
|
||||||
{
|
#endregion
|
||||||
// Needs to be overriden to add new authorization rules
|
} // Class
|
||||||
}
|
#region Converter
|
||||||
// Validation Rules
|
internal class FormatContentConverter : ExpandableObjectConverter
|
||||||
public virtual void AddValidationRules(Csla.Validation.ValidationRules rules)
|
{
|
||||||
{
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
// Needs to be overriden to add new validation rules
|
{
|
||||||
}
|
if (destType == typeof(string) && value is FormatContent)
|
||||||
// InstanceValidation Rules
|
{
|
||||||
public virtual void AddInstanceValidationRules(Csla.Validation.ValidationRules rules)
|
// Return the ToString value
|
||||||
{
|
return ((FormatContent)value).ToString();
|
||||||
// Needs to be overriden to add new validation rules
|
}
|
||||||
}
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
}
|
}
|
||||||
#endregion
|
}
|
||||||
} // Class
|
#endregion
|
||||||
#region Converter
|
|
||||||
internal class FormatContentConverter : ExpandableObjectConverter
|
|
||||||
{
|
|
||||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
|
||||||
{
|
|
||||||
if (destType == typeof(string) && value is FormatContent)
|
|
||||||
{
|
|
||||||
// Return the ToString value
|
|
||||||
return ((FormatContent)value).ToString();
|
|
||||||
}
|
|
||||||
return base.ConvertTo(context, culture, value, destType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -19,373 +19,365 @@ using System.ComponentModel;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
public delegate void GridAuditInfoEvent(object sender);
|
public delegate void GridAuditInfoEvent(object sender);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// GridAuditInfo Generated by MyGeneration using the CSLA Object Mapping template
|
/// GridAuditInfo Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
[TypeConverter(typeof(GridAuditInfoConverter))]
|
[TypeConverter(typeof(GridAuditInfoConverter))]
|
||||||
public partial class GridAuditInfo : ReadOnlyBase<GridAuditInfo>, IDisposable
|
public partial class GridAuditInfo : ReadOnlyBase<GridAuditInfo>, IDisposable
|
||||||
{
|
{
|
||||||
public event GridAuditInfoEvent Changed;
|
public event GridAuditInfoEvent Changed;
|
||||||
private void OnChange()
|
private void OnChange()
|
||||||
{
|
{
|
||||||
if (Changed != null) Changed(this);
|
if (Changed != null) Changed(this);
|
||||||
}
|
}
|
||||||
#region Log4Net
|
#region Log4Net
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
private static List<GridAuditInfo> _CacheList = new List<GridAuditInfo>();
|
private static List<GridAuditInfo> _CacheList = new List<GridAuditInfo>();
|
||||||
protected static void AddToCache(GridAuditInfo gridAuditInfo)
|
protected static void AddToCache(GridAuditInfo gridAuditInfo)
|
||||||
{
|
{
|
||||||
if (!_CacheList.Contains(gridAuditInfo)) _CacheList.Add(gridAuditInfo); // In AddToCache
|
if (!_CacheList.Contains(gridAuditInfo)) _CacheList.Add(gridAuditInfo); // In AddToCache
|
||||||
}
|
}
|
||||||
protected static void RemoveFromCache(GridAuditInfo gridAuditInfo)
|
protected static void RemoveFromCache(GridAuditInfo gridAuditInfo)
|
||||||
{
|
{
|
||||||
while (_CacheList.Contains(gridAuditInfo)) _CacheList.Remove(gridAuditInfo); // In RemoveFromCache
|
while (_CacheList.Contains(gridAuditInfo)) _CacheList.Remove(gridAuditInfo); // In RemoveFromCache
|
||||||
}
|
}
|
||||||
private static Dictionary<string, List<GridAuditInfo>> _CacheByPrimaryKey = new Dictionary<string, List<GridAuditInfo>>();
|
private static Dictionary<string, List<GridAuditInfo>> _CacheByPrimaryKey = new Dictionary<string, List<GridAuditInfo>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
while (_CacheList.Count > 0) // Move GridAuditInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
while (_CacheList.Count > 0) // Move GridAuditInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
||||||
{
|
{
|
||||||
GridAuditInfo tmp = _CacheList[0]; // Get the first GridAuditInfo
|
GridAuditInfo tmp = _CacheList[0]; // Get the first GridAuditInfo
|
||||||
string pKey = tmp.AuditID.ToString();
|
string pKey = tmp.AuditID.ToString();
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
||||||
{
|
{
|
||||||
_CacheByPrimaryKey[pKey] = new List<GridAuditInfo>(); // Add new list for PrimaryKey
|
_CacheByPrimaryKey[pKey] = new List<GridAuditInfo>(); // Add new list for PrimaryKey
|
||||||
}
|
}
|
||||||
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
||||||
_CacheList.RemoveAt(0); // Remove the first GridAuditInfo
|
_CacheList.RemoveAt(0); // Remove the first GridAuditInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
internal static void AddList(GridAuditInfoList lst)
|
internal static void AddList(GridAuditInfoList lst)
|
||||||
{
|
{
|
||||||
foreach (GridAuditInfo item in lst) AddToCache(item);
|
foreach (GridAuditInfo item in lst) AddToCache(item);
|
||||||
}
|
}
|
||||||
protected static GridAuditInfo GetCachedByPrimaryKey(long auditID)
|
protected static GridAuditInfo GetCachedByPrimaryKey(long auditID)
|
||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = auditID.ToString();
|
string key = auditID.ToString();
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Business Methods
|
#region Business Methods
|
||||||
private string _ErrorMessage = string.Empty;
|
private string _ErrorMessage = string.Empty;
|
||||||
public string ErrorMessage
|
public string ErrorMessage
|
||||||
{
|
{
|
||||||
get { return _ErrorMessage; }
|
get { return _ErrorMessage; }
|
||||||
}
|
}
|
||||||
protected GridAudit _Editable;
|
protected GridAudit _Editable;
|
||||||
private IVEHasBrokenRules HasBrokenRules
|
private IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
IVEHasBrokenRules hasBrokenRules = null;
|
IVEHasBrokenRules hasBrokenRules = null;
|
||||||
if (_Editable != null)
|
if (_Editable != null)
|
||||||
hasBrokenRules = _Editable.HasBrokenRules;
|
hasBrokenRules = _Editable.HasBrokenRules;
|
||||||
return hasBrokenRules;
|
return hasBrokenRules;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private long _AuditID;
|
private long _AuditID;
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
public long AuditID
|
public long AuditID
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("AuditID", true);
|
return _AuditID;
|
||||||
return _AuditID;
|
}
|
||||||
}
|
}
|
||||||
}
|
private int _ContentID;
|
||||||
private int _ContentID;
|
public int ContentID
|
||||||
public int ContentID
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
get
|
||||||
get
|
{
|
||||||
{
|
return _ContentID;
|
||||||
CanReadProperty("ContentID", true);
|
}
|
||||||
return _ContentID;
|
}
|
||||||
}
|
private string _Data = string.Empty;
|
||||||
}
|
public string Data
|
||||||
private string _Data = string.Empty;
|
{
|
||||||
public string Data
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
return _Data;
|
||||||
{
|
}
|
||||||
CanReadProperty("Data", true);
|
}
|
||||||
return _Data;
|
private string _Config = string.Empty;
|
||||||
}
|
public string Config
|
||||||
}
|
{
|
||||||
private string _Config = string.Empty;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
public string Config
|
get
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
return _Config;
|
||||||
get
|
}
|
||||||
{
|
}
|
||||||
CanReadProperty("Config", true);
|
private DateTime _DTS = new DateTime();
|
||||||
return _Config;
|
public DateTime DTS
|
||||||
}
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
private DateTime _DTS = new DateTime();
|
get
|
||||||
public DateTime DTS
|
{
|
||||||
{
|
return _DTS;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
}
|
||||||
{
|
private string _UserID = string.Empty;
|
||||||
CanReadProperty("DTS", true);
|
public string UserID
|
||||||
return _DTS;
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
private string _UserID = string.Empty;
|
{
|
||||||
public string UserID
|
return _UserID;
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
private int _DeleteStatus;
|
||||||
{
|
public int DeleteStatus
|
||||||
CanReadProperty("UserID", true);
|
{
|
||||||
return _UserID;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
}
|
{
|
||||||
private int _DeleteStatus;
|
return _DeleteStatus;
|
||||||
public int DeleteStatus
|
}
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
private long _ContentAuditID;
|
||||||
get
|
public long ContentAuditID
|
||||||
{
|
{
|
||||||
CanReadProperty("DeleteStatus", true);
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
return _DeleteStatus;
|
get
|
||||||
}
|
{
|
||||||
}
|
return _ContentAuditID;
|
||||||
private long _ContentAuditID;
|
}
|
||||||
public long ContentAuditID
|
}
|
||||||
{
|
// CSLATODO: Replace base GridAuditInfo.ToString function as necessary
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
/// <summary>
|
||||||
get
|
/// Overrides Base ToString
|
||||||
{
|
/// </summary>
|
||||||
CanReadProperty("ContentAuditID", true);
|
/// <returns>A string representation of current GridAuditInfo</returns>
|
||||||
return _ContentAuditID;
|
//public override string ToString()
|
||||||
}
|
//{
|
||||||
}
|
// return base.ToString();
|
||||||
// CSLATODO: Replace base GridAuditInfo.ToString function as necessary
|
//}
|
||||||
/// <summary>
|
// CSLATODO: Check GridAuditInfo.GetIdValue to assure that the ID returned is unique
|
||||||
/// Overrides Base ToString
|
/// <summary>
|
||||||
/// </summary>
|
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||||
/// <returns>A string representation of current GridAuditInfo</returns>
|
/// </summary>
|
||||||
//public override string ToString()
|
/// <returns>A Unique ID for the current GridAuditInfo</returns>
|
||||||
//{
|
protected override object GetIdValue()
|
||||||
// return base.ToString();
|
{
|
||||||
//}
|
return MyGridAuditInfoUnique; // Absolutely Unique ID
|
||||||
// CSLATODO: Check GridAuditInfo.GetIdValue to assure that the ID returned is unique
|
}
|
||||||
/// <summary>
|
#endregion
|
||||||
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
#region Factory Methods
|
||||||
/// </summary>
|
private static int _GridAuditInfoUnique = 0;
|
||||||
/// <returns>A Unique ID for the current GridAuditInfo</returns>
|
private static int GridAuditInfoUnique
|
||||||
protected override object GetIdValue()
|
{ get { return ++_GridAuditInfoUnique; } }
|
||||||
{
|
private int _MyGridAuditInfoUnique = GridAuditInfoUnique;
|
||||||
return MyGridAuditInfoUnique; // Absolutely Unique ID
|
public int MyGridAuditInfoUnique // Absolutely Unique ID - Info
|
||||||
}
|
{ get { return _MyGridAuditInfoUnique; } }
|
||||||
#endregion
|
protected GridAuditInfo()
|
||||||
#region Factory Methods
|
{/* require use of factory methods */
|
||||||
private static int _GridAuditInfoUnique = 0;
|
AddToCache(this);
|
||||||
private static int GridAuditInfoUnique
|
}
|
||||||
{ get { return ++_GridAuditInfoUnique; } }
|
private bool _Disposed = false;
|
||||||
private int _MyGridAuditInfoUnique = GridAuditInfoUnique;
|
private static int _CountCreated = 0;
|
||||||
public int MyGridAuditInfoUnique // Absolutely Unique ID - Info
|
private static int _CountDisposed = 0;
|
||||||
{ get { return _MyGridAuditInfoUnique; } }
|
private static int _CountFinalized = 0;
|
||||||
protected GridAuditInfo()
|
private static int IncrementCountCreated
|
||||||
{/* require use of factory methods */
|
{ get { return ++_CountCreated; } }
|
||||||
AddToCache(this);
|
private int _CountWhenCreated = IncrementCountCreated;
|
||||||
}
|
public static int CountCreated
|
||||||
private bool _Disposed = false;
|
{ get { return _CountCreated; } }
|
||||||
private static int _CountCreated = 0;
|
public static int CountNotDisposed
|
||||||
private static int _CountDisposed = 0;
|
{ get { return _CountCreated - _CountDisposed; } }
|
||||||
private static int _CountFinalized = 0;
|
public static int CountNotFinalized
|
||||||
private static int IncrementCountCreated
|
{ get { return _CountCreated - _CountFinalized; } }
|
||||||
{ get { return ++_CountCreated; } }
|
~GridAuditInfo()
|
||||||
private int _CountWhenCreated = IncrementCountCreated;
|
{
|
||||||
public static int CountCreated
|
_CountFinalized++;
|
||||||
{ get { return _CountCreated; } }
|
}
|
||||||
public static int CountNotDisposed
|
public void Dispose()
|
||||||
{ get { return _CountCreated - _CountDisposed; } }
|
{
|
||||||
public static int CountNotFinalized
|
if (_Disposed) return;
|
||||||
{ get { return _CountCreated - _CountFinalized; } }
|
_CountDisposed++;
|
||||||
~GridAuditInfo()
|
_Disposed = true;
|
||||||
{
|
RemoveFromCache(this);
|
||||||
_CountFinalized++;
|
if (!_CacheByPrimaryKey.ContainsKey(AuditID.ToString())) return;
|
||||||
}
|
List<GridAuditInfo> listGridAuditInfo = _CacheByPrimaryKey[AuditID.ToString()]; // Get the list of items
|
||||||
public void Dispose()
|
while (listGridAuditInfo.Contains(this)) listGridAuditInfo.Remove(this); // Remove the item from the list
|
||||||
{
|
if (listGridAuditInfo.Count == 0) // If there are no items left in the list
|
||||||
if (_Disposed) return;
|
_CacheByPrimaryKey.Remove(AuditID.ToString()); // remove the list
|
||||||
_CountDisposed++;
|
}
|
||||||
_Disposed = true;
|
public virtual GridAudit Get()
|
||||||
RemoveFromCache(this);
|
{
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(AuditID.ToString())) return;
|
return _Editable = GridAudit.Get(_AuditID);
|
||||||
List<GridAuditInfo> listGridAuditInfo = _CacheByPrimaryKey[AuditID.ToString()]; // Get the list of items
|
}
|
||||||
while (listGridAuditInfo.Contains(this)) listGridAuditInfo.Remove(this); // Remove the item from the list
|
public static void Refresh(GridAudit tmp)
|
||||||
if (listGridAuditInfo.Count == 0) // If there are no items left in the list
|
{
|
||||||
_CacheByPrimaryKey.Remove(AuditID.ToString()); // remove the list
|
string key = tmp.AuditID.ToString();
|
||||||
}
|
ConvertListToDictionary();
|
||||||
public virtual GridAudit Get()
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
{
|
foreach (GridAuditInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
return _Editable = GridAudit.Get(_AuditID);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
public static void Refresh(GridAudit tmp)
|
protected virtual void RefreshFields(GridAudit tmp)
|
||||||
{
|
{
|
||||||
string key = tmp.AuditID.ToString();
|
_ContentID = tmp.ContentID;
|
||||||
ConvertListToDictionary();
|
_Data = tmp.Data;
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
_Config = tmp.Config;
|
||||||
foreach (GridAuditInfo tmpInfo in _CacheByPrimaryKey[key])
|
_DTS = tmp.DTS;
|
||||||
tmpInfo.RefreshFields(tmp);
|
_UserID = tmp.UserID;
|
||||||
}
|
_DeleteStatus = tmp.DeleteStatus;
|
||||||
protected virtual void RefreshFields(GridAudit tmp)
|
_ContentAuditID = tmp.ContentAuditID;
|
||||||
{
|
_GridAuditInfoExtension.Refresh(this);
|
||||||
_ContentID = tmp.ContentID;
|
OnChange();// raise an event
|
||||||
_Data = tmp.Data;
|
}
|
||||||
_Config = tmp.Config;
|
public static GridAuditInfo Get(long auditID)
|
||||||
_DTS = tmp.DTS;
|
{
|
||||||
_UserID = tmp.UserID;
|
//if (!CanGetObject())
|
||||||
_DeleteStatus = tmp.DeleteStatus;
|
// throw new System.Security.SecurityException("User not authorized to view a GridAudit");
|
||||||
_ContentAuditID = tmp.ContentAuditID;
|
try
|
||||||
_GridAuditInfoExtension.Refresh(this);
|
{
|
||||||
OnChange();// raise an event
|
GridAuditInfo tmp = GetCachedByPrimaryKey(auditID);
|
||||||
}
|
if (tmp == null)
|
||||||
public static GridAuditInfo Get(long auditID)
|
{
|
||||||
{
|
tmp = DataPortal.Fetch<GridAuditInfo>(new PKCriteria(auditID));
|
||||||
//if (!CanGetObject())
|
AddToCache(tmp);
|
||||||
// throw new System.Security.SecurityException("User not authorized to view a GridAudit");
|
}
|
||||||
try
|
if (tmp.ErrorMessage == "No Record Found")
|
||||||
{
|
{
|
||||||
GridAuditInfo tmp = GetCachedByPrimaryKey(auditID);
|
tmp.Dispose(); // Clean-up GridAuditInfo
|
||||||
if (tmp == null)
|
tmp = null;
|
||||||
{
|
}
|
||||||
tmp = DataPortal.Fetch<GridAuditInfo>(new PKCriteria(auditID));
|
return tmp;
|
||||||
AddToCache(tmp);
|
}
|
||||||
}
|
catch (Exception ex)
|
||||||
if (tmp.ErrorMessage == "No Record Found")
|
{
|
||||||
{
|
throw new DbCslaException("Error on GridAuditInfo.Get", ex);
|
||||||
tmp.Dispose(); // Clean-up GridAuditInfo
|
}
|
||||||
tmp = null;
|
}
|
||||||
}
|
#endregion
|
||||||
return tmp;
|
#region Data Access Portal
|
||||||
}
|
internal GridAuditInfo(SafeDataReader dr)
|
||||||
catch (Exception ex)
|
{
|
||||||
{
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] GridAuditInfo.Constructor", GetHashCode());
|
||||||
throw new DbCslaException("Error on GridAuditInfo.Get", ex);
|
try
|
||||||
}
|
{
|
||||||
}
|
ReadData(dr);
|
||||||
#endregion
|
}
|
||||||
#region Data Access Portal
|
catch (Exception ex)
|
||||||
internal GridAuditInfo(SafeDataReader dr)
|
{
|
||||||
{
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("GridAuditInfo.Constructor", ex);
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] GridAuditInfo.Constructor", GetHashCode());
|
throw new DbCslaException("GridAuditInfo.Constructor", ex);
|
||||||
try
|
}
|
||||||
{
|
}
|
||||||
ReadData(dr);
|
[Serializable()]
|
||||||
}
|
protected class PKCriteria
|
||||||
catch (Exception ex)
|
{
|
||||||
{
|
private long _AuditID;
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("GridAuditInfo.Constructor", ex);
|
public long AuditID
|
||||||
throw new DbCslaException("GridAuditInfo.Constructor", ex);
|
{ get { return _AuditID; } }
|
||||||
}
|
public PKCriteria(long auditID)
|
||||||
}
|
{
|
||||||
[Serializable()]
|
_AuditID = auditID;
|
||||||
protected class PKCriteria
|
}
|
||||||
{
|
}
|
||||||
private long _AuditID;
|
private void ReadData(SafeDataReader dr)
|
||||||
public long AuditID
|
{
|
||||||
{ get { return _AuditID; } }
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] GridAuditInfo.ReadData", GetHashCode());
|
||||||
public PKCriteria(long auditID)
|
try
|
||||||
{
|
{
|
||||||
_AuditID = auditID;
|
_AuditID = dr.GetInt64("AuditID");
|
||||||
}
|
_ContentID = dr.GetInt32("ContentID");
|
||||||
}
|
_Data = dr.GetString("Data");
|
||||||
private void ReadData(SafeDataReader dr)
|
_Config = dr.GetString("Config");
|
||||||
{
|
_DTS = dr.GetDateTime("DTS");
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] GridAuditInfo.ReadData", GetHashCode());
|
_UserID = dr.GetString("UserID");
|
||||||
try
|
_DeleteStatus = dr.GetInt32("DeleteStatus");
|
||||||
{
|
_ContentAuditID = dr.GetInt64("ContentAuditID");
|
||||||
_AuditID = dr.GetInt64("AuditID");
|
}
|
||||||
_ContentID = dr.GetInt32("ContentID");
|
catch (Exception ex)
|
||||||
_Data = dr.GetString("Data");
|
{
|
||||||
_Config = dr.GetString("Config");
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("GridAuditInfo.ReadData", ex);
|
||||||
_DTS = dr.GetDateTime("DTS");
|
_ErrorMessage = ex.Message;
|
||||||
_UserID = dr.GetString("UserID");
|
throw new DbCslaException("GridAuditInfo.ReadData", ex);
|
||||||
_DeleteStatus = dr.GetInt32("DeleteStatus");
|
}
|
||||||
_ContentAuditID = dr.GetInt64("ContentAuditID");
|
}
|
||||||
}
|
private void DataPortal_Fetch(PKCriteria criteria)
|
||||||
catch (Exception ex)
|
{
|
||||||
{
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] GridAuditInfo.DataPortal_Fetch", GetHashCode());
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("GridAuditInfo.ReadData", ex);
|
try
|
||||||
_ErrorMessage = ex.Message;
|
{
|
||||||
throw new DbCslaException("GridAuditInfo.ReadData", ex);
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
}
|
{
|
||||||
}
|
ApplicationContext.LocalContext["cn"] = cn;
|
||||||
private void DataPortal_Fetch(PKCriteria criteria)
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
{
|
{
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] GridAuditInfo.DataPortal_Fetch", GetHashCode());
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
try
|
cm.CommandText = "getGridAudit";
|
||||||
{
|
cm.Parameters.AddWithValue("@AuditID", criteria.AuditID);
|
||||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
{
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
ApplicationContext.LocalContext["cn"] = cn;
|
{
|
||||||
using (SqlCommand cm = cn.CreateCommand())
|
if (!dr.Read())
|
||||||
{
|
{
|
||||||
cm.CommandType = CommandType.StoredProcedure;
|
_ErrorMessage = "No Record Found";
|
||||||
cm.CommandText = "getGridAudit";
|
return;
|
||||||
cm.Parameters.AddWithValue("@AuditID", criteria.AuditID);
|
}
|
||||||
cm.CommandTimeout = Database.DefaultTimeout;
|
ReadData(dr);
|
||||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
}
|
||||||
{
|
}
|
||||||
if (!dr.Read())
|
// removing of item only needed for local data portal
|
||||||
{
|
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
||||||
_ErrorMessage = "No Record Found";
|
ApplicationContext.LocalContext.Remove("cn");
|
||||||
return;
|
}
|
||||||
}
|
}
|
||||||
ReadData(dr);
|
catch (Exception ex)
|
||||||
}
|
{
|
||||||
}
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("GridAuditInfo.DataPortal_Fetch", ex);
|
||||||
// removing of item only needed for local data portal
|
_ErrorMessage = ex.Message;
|
||||||
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
throw new DbCslaException("GridAuditInfo.DataPortal_Fetch", ex);
|
||||||
ApplicationContext.LocalContext.Remove("cn");
|
}
|
||||||
}
|
}
|
||||||
}
|
#endregion
|
||||||
catch (Exception ex)
|
// Standard Refresh
|
||||||
{
|
#region extension
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("GridAuditInfo.DataPortal_Fetch", ex);
|
GridAuditInfoExtension _GridAuditInfoExtension = new GridAuditInfoExtension();
|
||||||
_ErrorMessage = ex.Message;
|
[Serializable()]
|
||||||
throw new DbCslaException("GridAuditInfo.DataPortal_Fetch", ex);
|
partial class GridAuditInfoExtension : extensionBase { }
|
||||||
}
|
[Serializable()]
|
||||||
}
|
class extensionBase
|
||||||
#endregion
|
{
|
||||||
// Standard Refresh
|
// Default Refresh
|
||||||
#region extension
|
public virtual void Refresh(GridAuditInfo tmp) { }
|
||||||
GridAuditInfoExtension _GridAuditInfoExtension = new GridAuditInfoExtension();
|
}
|
||||||
[Serializable()]
|
#endregion
|
||||||
partial class GridAuditInfoExtension : extensionBase { }
|
} // Class
|
||||||
[Serializable()]
|
#region Converter
|
||||||
class extensionBase
|
internal class GridAuditInfoConverter : ExpandableObjectConverter
|
||||||
{
|
{
|
||||||
// Default Refresh
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
public virtual void Refresh(GridAuditInfo tmp) { }
|
{
|
||||||
}
|
if (destType == typeof(string) && value is GridAuditInfo)
|
||||||
#endregion
|
{
|
||||||
} // Class
|
// Return the ToString value
|
||||||
#region Converter
|
return ((GridAuditInfo)value).ToString();
|
||||||
internal class GridAuditInfoConverter : ExpandableObjectConverter
|
}
|
||||||
{
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
}
|
||||||
{
|
}
|
||||||
if (destType == typeof(string) && value is GridAuditInfo)
|
#endregion
|
||||||
{
|
|
||||||
// Return the ToString value
|
|
||||||
return ((GridAuditInfo)value).ToString();
|
|
||||||
}
|
|
||||||
return base.ConvertTo(context, culture, value, destType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
@ -17,348 +17,364 @@ using System.Configuration;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
public delegate void GridInfoEvent(object sender);
|
public delegate void GridInfoEvent(object sender);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// GridInfo Generated by MyGeneration using the CSLA Object Mapping template
|
/// GridInfo Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
[TypeConverter(typeof(GridInfoConverter))]
|
[TypeConverter(typeof(GridInfoConverter))]
|
||||||
public partial class GridInfo : ReadOnlyBase<GridInfo>, IDisposable
|
public partial class GridInfo : ReadOnlyBase<GridInfo>, IDisposable
|
||||||
{
|
{
|
||||||
public event GridInfoEvent Changed;
|
public event GridInfoEvent Changed;
|
||||||
private void OnChange()
|
private void OnChange()
|
||||||
{
|
{
|
||||||
if (Changed != null) Changed(this);
|
if (Changed != null) Changed(this);
|
||||||
}
|
}
|
||||||
#region Log4Net
|
#region Log4Net
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
private static List<GridInfo> _CacheList = new List<GridInfo>();
|
private static List<GridInfo> _CacheList = new List<GridInfo>();
|
||||||
protected static void AddToCache(GridInfo gridInfo)
|
protected static void AddToCache(GridInfo gridInfo)
|
||||||
{
|
{
|
||||||
if (!_CacheList.Contains(gridInfo)) _CacheList.Add(gridInfo); // In AddToCache
|
if (!_CacheList.Contains(gridInfo)) _CacheList.Add(gridInfo); // In AddToCache
|
||||||
}
|
}
|
||||||
protected static void RemoveFromCache(GridInfo gridInfo)
|
protected static void RemoveFromCache(GridInfo gridInfo)
|
||||||
{
|
{
|
||||||
while (_CacheList.Contains(gridInfo)) _CacheList.Remove(gridInfo); // In RemoveFromCache
|
while (_CacheList.Contains(gridInfo)) _CacheList.Remove(gridInfo); // In RemoveFromCache
|
||||||
}
|
}
|
||||||
private static Dictionary<string, List<GridInfo>> _CacheByPrimaryKey = new Dictionary<string, List<GridInfo>>();
|
private static Dictionary<string, List<GridInfo>> _CacheByPrimaryKey = new Dictionary<string, List<GridInfo>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
while (_CacheList.Count > 0) // Move GridInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
while (_CacheList.Count > 0) // Move GridInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
||||||
{
|
{
|
||||||
GridInfo tmp = _CacheList[0]; // Get the first GridInfo
|
GridInfo tmp = _CacheList[0]; // Get the first GridInfo
|
||||||
string pKey = tmp.ContentID.ToString();
|
string pKey = tmp.ContentID.ToString();
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
||||||
{
|
{
|
||||||
_CacheByPrimaryKey[pKey] = new List<GridInfo>(); // Add new list for PrimaryKey
|
_CacheByPrimaryKey[pKey] = new List<GridInfo>(); // Add new list for PrimaryKey
|
||||||
}
|
}
|
||||||
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
||||||
_CacheList.RemoveAt(0); // Remove the first GridInfo
|
_CacheList.RemoveAt(0); // Remove the first GridInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
protected static GridInfo GetCachedByPrimaryKey(int contentID)
|
protected static GridInfo GetCachedByPrimaryKey(int contentID)
|
||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = contentID.ToString();
|
string key = contentID.ToString();
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
#region Business Methods
|
public static void ClearGridInfoCache()
|
||||||
private string _ErrorMessage = string.Empty;
|
{
|
||||||
public string ErrorMessage
|
while (_CacheByPrimaryKey.Count > 0)
|
||||||
{
|
{
|
||||||
get { return _ErrorMessage; }
|
var ii = _CacheByPrimaryKey.FirstOrDefault();
|
||||||
}
|
|
||||||
protected Grid _Editable;
|
while (ii.Value.Count > 0)
|
||||||
private IVEHasBrokenRules HasBrokenRules
|
{
|
||||||
{
|
if (ii.Value[0]?.MyContent?.ContentParts != null)
|
||||||
get
|
{ foreach (PartInfo pi in ii.Value[0]?.MyContent?.ContentParts) pi.Dispose(); }
|
||||||
{
|
ii.Value[0].Dispose();
|
||||||
IVEHasBrokenRules hasBrokenRules = null;
|
}
|
||||||
if (_Editable != null)
|
_CacheByPrimaryKey.Remove(ii.Key);
|
||||||
hasBrokenRules = _Editable.HasBrokenRules;
|
}
|
||||||
return hasBrokenRules;
|
while (_CacheList.Count > 0)
|
||||||
}
|
{
|
||||||
}
|
_CacheList[0].Dispose();
|
||||||
private int _ContentID;
|
}
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
}
|
||||||
public int ContentID
|
#endregion
|
||||||
{
|
#region Business Methods
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
private string _ErrorMessage = string.Empty;
|
||||||
get
|
public string ErrorMessage
|
||||||
{
|
{
|
||||||
CanReadProperty("ContentID", true);
|
get { return _ErrorMessage; }
|
||||||
if (_MyContent != null) _ContentID = _MyContent.ContentID;
|
}
|
||||||
return _ContentID;
|
protected Grid _Editable;
|
||||||
}
|
private IVEHasBrokenRules HasBrokenRules
|
||||||
}
|
{
|
||||||
private ContentInfo _MyContent;
|
get
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
{
|
||||||
public ContentInfo MyContent
|
IVEHasBrokenRules hasBrokenRules = null;
|
||||||
{
|
if (_Editable != null)
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
hasBrokenRules = _Editable.HasBrokenRules;
|
||||||
get
|
return hasBrokenRules;
|
||||||
{
|
}
|
||||||
CanReadProperty("MyContent", true);
|
}
|
||||||
if (_MyContent == null && _ContentID != 0) _MyContent = ContentInfo.Get(_ContentID);
|
private int _ContentID;
|
||||||
return _MyContent;
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
}
|
public int ContentID
|
||||||
}
|
{
|
||||||
private string _Data = string.Empty;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
public string Data
|
get
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
if (_MyContent != null) _ContentID = _MyContent.ContentID;
|
||||||
get
|
return _ContentID;
|
||||||
{
|
}
|
||||||
CanReadProperty("Data", true);
|
}
|
||||||
return _Data;
|
private ContentInfo _MyContent;
|
||||||
}
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
}
|
public ContentInfo MyContent
|
||||||
private string _Config = string.Empty;
|
{
|
||||||
public string Config
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
if (_MyContent == null && _ContentID != 0) _MyContent = ContentInfo.Get(_ContentID);
|
||||||
{
|
return _MyContent;
|
||||||
CanReadProperty("Config", true);
|
}
|
||||||
return _Config;
|
}
|
||||||
}
|
private string _Data = string.Empty;
|
||||||
}
|
public string Data
|
||||||
private DateTime _DTS = new DateTime();
|
{
|
||||||
public DateTime DTS
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
return _Data;
|
||||||
{
|
}
|
||||||
CanReadProperty("DTS", true);
|
}
|
||||||
return _DTS;
|
private string _Config = string.Empty;
|
||||||
}
|
public string Config
|
||||||
}
|
{
|
||||||
private string _UserID = string.Empty;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
public string UserID
|
get
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
return _Config;
|
||||||
get
|
}
|
||||||
{
|
}
|
||||||
CanReadProperty("UserID", true);
|
private DateTime _DTS = new DateTime();
|
||||||
return _UserID;
|
public DateTime DTS
|
||||||
}
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
// CSLATODO: Replace base GridInfo.ToString function as necessary
|
get
|
||||||
/// <summary>
|
{
|
||||||
/// Overrides Base ToString
|
return _DTS;
|
||||||
/// </summary>
|
}
|
||||||
/// <returns>A string representation of current GridInfo</returns>
|
}
|
||||||
//public override string ToString()
|
private string _UserID = string.Empty;
|
||||||
//{
|
public string UserID
|
||||||
// return base.ToString();
|
{
|
||||||
//}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
// CSLATODO: Check GridInfo.GetIdValue to assure that the ID returned is unique
|
get
|
||||||
/// <summary>
|
{
|
||||||
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
return _UserID;
|
||||||
/// </summary>
|
}
|
||||||
/// <returns>A Unique ID for the current GridInfo</returns>
|
}
|
||||||
protected override object GetIdValue()
|
// CSLATODO: Replace base GridInfo.ToString function as necessary
|
||||||
{
|
/// <summary>
|
||||||
return MyGridInfoUnique; // Absolutely Unique ID
|
/// Overrides Base ToString
|
||||||
}
|
/// </summary>
|
||||||
#endregion
|
/// <returns>A string representation of current GridInfo</returns>
|
||||||
#region Factory Methods
|
//public override string ToString()
|
||||||
private static int _GridInfoUnique = 0;
|
//{
|
||||||
private static int GridInfoUnique
|
// return base.ToString();
|
||||||
{ get { return ++_GridInfoUnique; } }
|
//}
|
||||||
private int _MyGridInfoUnique = GridInfoUnique;
|
// CSLATODO: Check GridInfo.GetIdValue to assure that the ID returned is unique
|
||||||
public int MyGridInfoUnique // Absolutely Unique ID - Info
|
/// <summary>
|
||||||
{ get { return _MyGridInfoUnique; } }
|
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||||
protected GridInfo()
|
/// </summary>
|
||||||
{/* require use of factory methods */
|
/// <returns>A Unique ID for the current GridInfo</returns>
|
||||||
AddToCache(this);
|
protected override object GetIdValue()
|
||||||
}
|
{
|
||||||
private bool _Disposed = false;
|
return MyGridInfoUnique; // Absolutely Unique ID
|
||||||
private static int _CountCreated = 0;
|
}
|
||||||
private static int _CountDisposed = 0;
|
#endregion
|
||||||
private static int _CountFinalized = 0;
|
#region Factory Methods
|
||||||
private static int IncrementCountCreated
|
private static int _GridInfoUnique = 0;
|
||||||
{ get { return ++_CountCreated; } }
|
private static int GridInfoUnique
|
||||||
private int _CountWhenCreated = IncrementCountCreated;
|
{ get { return ++_GridInfoUnique; } }
|
||||||
public static int CountCreated
|
private int _MyGridInfoUnique = GridInfoUnique;
|
||||||
{ get { return _CountCreated; } }
|
public int MyGridInfoUnique // Absolutely Unique ID - Info
|
||||||
public static int CountNotDisposed
|
{ get { return _MyGridInfoUnique; } }
|
||||||
{ get { return _CountCreated - _CountDisposed; } }
|
protected GridInfo()
|
||||||
public static int CountNotFinalized
|
{/* require use of factory methods */
|
||||||
{ get { return _CountCreated - _CountFinalized; } }
|
AddToCache(this);
|
||||||
~GridInfo()
|
}
|
||||||
{
|
private bool _Disposed = false;
|
||||||
_CountFinalized++;
|
private static int _CountCreated = 0;
|
||||||
}
|
private static int _CountDisposed = 0;
|
||||||
public void Dispose()
|
private static int _CountFinalized = 0;
|
||||||
{
|
private static int IncrementCountCreated
|
||||||
if (_Disposed) return;
|
{ get { return ++_CountCreated; } }
|
||||||
_CountDisposed++;
|
private int _CountWhenCreated = IncrementCountCreated;
|
||||||
_Disposed = true;
|
public static int CountCreated
|
||||||
RemoveFromCache(this);
|
{ get { return _CountCreated; } }
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(ContentID.ToString())) return;
|
public static int CountNotDisposed
|
||||||
List<GridInfo> listGridInfo = _CacheByPrimaryKey[ContentID.ToString()]; // Get the list of items
|
{ get { return _CountCreated - _CountDisposed; } }
|
||||||
while (listGridInfo.Contains(this)) listGridInfo.Remove(this); // Remove the item from the list
|
public static int CountNotFinalized
|
||||||
if (listGridInfo.Count == 0) // If there are no items left in the list
|
{ get { return _CountCreated - _CountFinalized; } }
|
||||||
_CacheByPrimaryKey.Remove(ContentID.ToString()); // remove the list
|
~GridInfo()
|
||||||
}
|
{
|
||||||
public virtual Grid Get()
|
_CountFinalized++;
|
||||||
{
|
}
|
||||||
return _Editable = Grid.Get(_ContentID);
|
public void Dispose()
|
||||||
}
|
{
|
||||||
public static void Refresh(Grid tmp)
|
if (_Disposed) return;
|
||||||
{
|
_CountDisposed++;
|
||||||
string key = tmp.ContentID.ToString();
|
_Disposed = true;
|
||||||
ConvertListToDictionary();
|
RemoveFromCache(this);
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
if (!_CacheByPrimaryKey.ContainsKey(ContentID.ToString())) return;
|
||||||
foreach (GridInfo tmpInfo in _CacheByPrimaryKey[key])
|
List<GridInfo> listGridInfo = _CacheByPrimaryKey[ContentID.ToString()]; // Get the list of items
|
||||||
tmpInfo.RefreshFields(tmp);
|
while (listGridInfo.Contains(this)) listGridInfo.Remove(this); // Remove the item from the list
|
||||||
}
|
if (listGridInfo.Count == 0) // If there are no items left in the list
|
||||||
protected virtual void RefreshFields(Grid tmp)
|
_CacheByPrimaryKey.Remove(ContentID.ToString()); // remove the list
|
||||||
{
|
}
|
||||||
_Data = tmp.Data;
|
public virtual Grid Get()
|
||||||
_Config = tmp.Config;
|
{
|
||||||
_DTS = tmp.DTS;
|
return _Editable = Grid.Get(_ContentID);
|
||||||
_UserID = tmp.UserID;
|
}
|
||||||
_GridInfoExtension.Refresh(this);
|
public static void Refresh(Grid tmp)
|
||||||
OnChange();// raise an event
|
{
|
||||||
}
|
string key = tmp.ContentID.ToString();
|
||||||
public static GridInfo Get(int contentID)
|
ConvertListToDictionary();
|
||||||
{
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
//if (!CanGetObject())
|
foreach (GridInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
// throw new System.Security.SecurityException("User not authorized to view a Grid");
|
tmpInfo.RefreshFields(tmp);
|
||||||
try
|
}
|
||||||
{
|
protected virtual void RefreshFields(Grid tmp)
|
||||||
GridInfo tmp = GetCachedByPrimaryKey(contentID);
|
{
|
||||||
if (tmp == null)
|
_Data = tmp.Data;
|
||||||
{
|
_Config = tmp.Config;
|
||||||
tmp = DataPortal.Fetch<GridInfo>(new PKCriteria(contentID));
|
_DTS = tmp.DTS;
|
||||||
AddToCache(tmp);
|
_UserID = tmp.UserID;
|
||||||
}
|
_GridInfoExtension.Refresh(this);
|
||||||
if (tmp.ErrorMessage == "No Record Found")
|
OnChange();// raise an event
|
||||||
{
|
}
|
||||||
tmp.Dispose(); // Clean-up GridInfo
|
public static GridInfo Get(int contentID)
|
||||||
tmp = null;
|
{
|
||||||
}
|
//if (!CanGetObject())
|
||||||
return tmp;
|
// throw new System.Security.SecurityException("User not authorized to view a Grid");
|
||||||
}
|
try
|
||||||
catch (Exception ex)
|
{
|
||||||
{
|
GridInfo tmp = GetCachedByPrimaryKey(contentID);
|
||||||
throw new DbCslaException("Error on GridInfo.Get", ex);
|
if (tmp == null)
|
||||||
}
|
{
|
||||||
}
|
tmp = DataPortal.Fetch<GridInfo>(new PKCriteria(contentID));
|
||||||
#endregion
|
AddToCache(tmp);
|
||||||
#region Data Access Portal
|
}
|
||||||
internal GridInfo(SafeDataReader dr)
|
if (tmp.ErrorMessage == "No Record Found")
|
||||||
{
|
{
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] GridInfo.Constructor", GetHashCode());
|
tmp.Dispose(); // Clean-up GridInfo
|
||||||
try
|
tmp = null;
|
||||||
{
|
}
|
||||||
ReadData(dr);
|
return tmp;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("GridInfo.Constructor", ex);
|
throw new DbCslaException("Error on GridInfo.Get", ex);
|
||||||
throw new DbCslaException("GridInfo.Constructor", ex);
|
}
|
||||||
}
|
}
|
||||||
}
|
#endregion
|
||||||
[Serializable()]
|
#region Data Access Portal
|
||||||
protected class PKCriteria
|
internal GridInfo(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
private int _ContentID;
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] GridInfo.Constructor", GetHashCode());
|
||||||
public int ContentID
|
try
|
||||||
{ get { return _ContentID; } }
|
{
|
||||||
public PKCriteria(int contentID)
|
ReadData(dr);
|
||||||
{
|
}
|
||||||
_ContentID = contentID;
|
catch (Exception ex)
|
||||||
}
|
{
|
||||||
}
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("GridInfo.Constructor", ex);
|
||||||
private void ReadData(SafeDataReader dr)
|
throw new DbCslaException("GridInfo.Constructor", ex);
|
||||||
{
|
}
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] GridInfo.ReadData", GetHashCode());
|
}
|
||||||
try
|
[Serializable()]
|
||||||
{
|
protected class PKCriteria
|
||||||
_ContentID = dr.GetInt32("ContentID");
|
{
|
||||||
_Data = dr.GetString("Data");
|
private int _ContentID;
|
||||||
_Config = dr.GetString("Config");
|
public int ContentID
|
||||||
_DTS = dr.GetDateTime("DTS");
|
{ get { return _ContentID; } }
|
||||||
_UserID = dr.GetString("UserID");
|
public PKCriteria(int contentID)
|
||||||
}
|
{
|
||||||
catch (Exception ex)
|
_ContentID = contentID;
|
||||||
{
|
}
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("GridInfo.ReadData", ex);
|
}
|
||||||
_ErrorMessage = ex.Message;
|
private void ReadData(SafeDataReader dr)
|
||||||
throw new DbCslaException("GridInfo.ReadData", ex);
|
{
|
||||||
}
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] GridInfo.ReadData", GetHashCode());
|
||||||
}
|
try
|
||||||
private void DataPortal_Fetch(PKCriteria criteria)
|
{
|
||||||
{
|
_ContentID = dr.GetInt32("ContentID");
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] GridInfo.DataPortal_Fetch", GetHashCode());
|
_Data = dr.GetString("Data");
|
||||||
try
|
_Config = dr.GetString("Config");
|
||||||
{
|
_DTS = dr.GetDateTime("DTS");
|
||||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
_UserID = dr.GetString("UserID");
|
||||||
{
|
}
|
||||||
ApplicationContext.LocalContext["cn"] = cn;
|
catch (Exception ex)
|
||||||
using (SqlCommand cm = cn.CreateCommand())
|
{
|
||||||
{
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("GridInfo.ReadData", ex);
|
||||||
cm.CommandType = CommandType.StoredProcedure;
|
_ErrorMessage = ex.Message;
|
||||||
cm.CommandText = "getGrid";
|
throw new DbCslaException("GridInfo.ReadData", ex);
|
||||||
cm.Parameters.AddWithValue("@ContentID", criteria.ContentID);
|
}
|
||||||
cm.CommandTimeout = Database.DefaultTimeout;
|
}
|
||||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
private void DataPortal_Fetch(PKCriteria criteria)
|
||||||
{
|
{
|
||||||
if (!dr.Read())
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] GridInfo.DataPortal_Fetch", GetHashCode());
|
||||||
{
|
try
|
||||||
_ErrorMessage = "No Record Found";
|
{
|
||||||
return;
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
}
|
{
|
||||||
ReadData(dr);
|
ApplicationContext.LocalContext["cn"] = cn;
|
||||||
}
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
}
|
{
|
||||||
// removing of item only needed for local data portal
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
cm.CommandText = "getGrid";
|
||||||
ApplicationContext.LocalContext.Remove("cn");
|
cm.Parameters.AddWithValue("@ContentID", criteria.ContentID);
|
||||||
}
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
}
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
catch (Exception ex)
|
{
|
||||||
{
|
if (!dr.Read())
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("GridInfo.DataPortal_Fetch", ex);
|
{
|
||||||
_ErrorMessage = ex.Message;
|
_ErrorMessage = "No Record Found";
|
||||||
throw new DbCslaException("GridInfo.DataPortal_Fetch", ex);
|
return;
|
||||||
}
|
}
|
||||||
}
|
ReadData(dr);
|
||||||
#endregion
|
}
|
||||||
// Standard Refresh
|
}
|
||||||
#region extension
|
// removing of item only needed for local data portal
|
||||||
GridInfoExtension _GridInfoExtension = new GridInfoExtension();
|
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
||||||
[Serializable()]
|
ApplicationContext.LocalContext.Remove("cn");
|
||||||
partial class GridInfoExtension : extensionBase { }
|
}
|
||||||
[Serializable()]
|
}
|
||||||
class extensionBase
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
// Default Refresh
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("GridInfo.DataPortal_Fetch", ex);
|
||||||
public virtual void Refresh(GridInfo tmp) { }
|
_ErrorMessage = ex.Message;
|
||||||
}
|
throw new DbCslaException("GridInfo.DataPortal_Fetch", ex);
|
||||||
#endregion
|
}
|
||||||
} // Class
|
}
|
||||||
#region Converter
|
#endregion
|
||||||
internal class GridInfoConverter : ExpandableObjectConverter
|
// Standard Refresh
|
||||||
{
|
#region extension
|
||||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
GridInfoExtension _GridInfoExtension = new GridInfoExtension();
|
||||||
{
|
[Serializable()]
|
||||||
if (destType == typeof(string) && value is GridInfo)
|
partial class GridInfoExtension : extensionBase { }
|
||||||
{
|
[Serializable()]
|
||||||
// Return the ToString value
|
class extensionBase
|
||||||
return ((GridInfo)value).ToString();
|
{
|
||||||
}
|
// Default Refresh
|
||||||
return base.ConvertTo(context, culture, value, destType);
|
public virtual void Refresh(GridInfo tmp) { }
|
||||||
}
|
}
|
||||||
}
|
#endregion
|
||||||
#endregion
|
} // Class
|
||||||
|
#region Converter
|
||||||
|
internal class GridInfoConverter : ExpandableObjectConverter
|
||||||
|
{
|
||||||
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
|
{
|
||||||
|
if (destType == typeof(string) && value is GridInfo)
|
||||||
|
{
|
||||||
|
// Return the ToString value
|
||||||
|
return ((GridInfo)value).ToString();
|
||||||
|
}
|
||||||
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -19,427 +19,417 @@ using System.ComponentModel;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
public delegate void GroupInfoEvent(object sender);
|
public delegate void GroupInfoEvent(object sender);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// GroupInfo Generated by MyGeneration using the CSLA Object Mapping template
|
/// GroupInfo Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
[TypeConverter(typeof(GroupInfoConverter))]
|
[TypeConverter(typeof(GroupInfoConverter))]
|
||||||
public partial class GroupInfo : ReadOnlyBase<GroupInfo>, IDisposable
|
public partial class GroupInfo : ReadOnlyBase<GroupInfo>, IDisposable
|
||||||
{
|
{
|
||||||
public event GroupInfoEvent Changed;
|
public event GroupInfoEvent Changed;
|
||||||
private void OnChange()
|
private void OnChange()
|
||||||
{
|
{
|
||||||
if (Changed != null) Changed(this);
|
if (Changed != null) Changed(this);
|
||||||
}
|
}
|
||||||
#region Log4Net
|
#region Log4Net
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
private static List<GroupInfo> _CacheList = new List<GroupInfo>();
|
private static List<GroupInfo> _CacheList = new List<GroupInfo>();
|
||||||
protected static void AddToCache(GroupInfo groupInfo)
|
protected static void AddToCache(GroupInfo groupInfo)
|
||||||
{
|
{
|
||||||
if (!_CacheList.Contains(groupInfo)) _CacheList.Add(groupInfo); // In AddToCache
|
if (!_CacheList.Contains(groupInfo)) _CacheList.Add(groupInfo); // In AddToCache
|
||||||
}
|
}
|
||||||
protected static void RemoveFromCache(GroupInfo groupInfo)
|
protected static void RemoveFromCache(GroupInfo groupInfo)
|
||||||
{
|
{
|
||||||
while (_CacheList.Contains(groupInfo)) _CacheList.Remove(groupInfo); // In RemoveFromCache
|
while (_CacheList.Contains(groupInfo)) _CacheList.Remove(groupInfo); // In RemoveFromCache
|
||||||
}
|
}
|
||||||
private static Dictionary<string, List<GroupInfo>> _CacheByPrimaryKey = new Dictionary<string, List<GroupInfo>>();
|
private static Dictionary<string, List<GroupInfo>> _CacheByPrimaryKey = new Dictionary<string, List<GroupInfo>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
while (_CacheList.Count > 0) // Move GroupInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
while (_CacheList.Count > 0) // Move GroupInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
||||||
{
|
{
|
||||||
GroupInfo tmp = _CacheList[0]; // Get the first GroupInfo
|
GroupInfo tmp = _CacheList[0]; // Get the first GroupInfo
|
||||||
string pKey = tmp.GID.ToString();
|
string pKey = tmp.GID.ToString();
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
||||||
{
|
{
|
||||||
_CacheByPrimaryKey[pKey] = new List<GroupInfo>(); // Add new list for PrimaryKey
|
_CacheByPrimaryKey[pKey] = new List<GroupInfo>(); // Add new list for PrimaryKey
|
||||||
}
|
}
|
||||||
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
||||||
_CacheList.RemoveAt(0); // Remove the first GroupInfo
|
_CacheList.RemoveAt(0); // Remove the first GroupInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
internal static void AddList(GroupInfoList lst)
|
internal static void AddList(GroupInfoList lst)
|
||||||
{
|
{
|
||||||
foreach (GroupInfo item in lst) AddToCache(item);
|
foreach (GroupInfo item in lst) AddToCache(item);
|
||||||
}
|
}
|
||||||
protected static GroupInfo GetCachedByPrimaryKey(int gid)
|
protected static GroupInfo GetCachedByPrimaryKey(int gid)
|
||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = gid.ToString();
|
string key = gid.ToString();
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Business Methods
|
#region Business Methods
|
||||||
private string _ErrorMessage = string.Empty;
|
private string _ErrorMessage = string.Empty;
|
||||||
public string ErrorMessage
|
public string ErrorMessage
|
||||||
{
|
{
|
||||||
get { return _ErrorMessage; }
|
get { return _ErrorMessage; }
|
||||||
}
|
}
|
||||||
protected Group _Editable;
|
protected Group _Editable;
|
||||||
private IVEHasBrokenRules HasBrokenRules
|
private IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
IVEHasBrokenRules hasBrokenRules = null;
|
IVEHasBrokenRules hasBrokenRules = null;
|
||||||
if (_Editable != null)
|
if (_Editable != null)
|
||||||
hasBrokenRules = _Editable.HasBrokenRules;
|
hasBrokenRules = _Editable.HasBrokenRules;
|
||||||
return hasBrokenRules;
|
return hasBrokenRules;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private int _GID;
|
private int _GID;
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
public int GID
|
public int GID
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("GID", true);
|
return _GID;
|
||||||
return _GID;
|
}
|
||||||
}
|
}
|
||||||
}
|
private string _GroupName = string.Empty;
|
||||||
private string _GroupName = string.Empty;
|
public string GroupName
|
||||||
public string GroupName
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
get
|
||||||
get
|
{
|
||||||
{
|
return _GroupName;
|
||||||
CanReadProperty("GroupName", true);
|
}
|
||||||
return _GroupName;
|
}
|
||||||
}
|
private int? _GroupType;
|
||||||
}
|
public int? GroupType
|
||||||
private int? _GroupType;
|
{
|
||||||
public int? GroupType
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
return _GroupType;
|
||||||
{
|
}
|
||||||
CanReadProperty("GroupType", true);
|
}
|
||||||
return _GroupType;
|
private string _Config = string.Empty;
|
||||||
}
|
public string Config
|
||||||
}
|
{
|
||||||
private string _Config = string.Empty;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
public string Config
|
get
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
return _Config;
|
||||||
get
|
}
|
||||||
{
|
}
|
||||||
CanReadProperty("Config", true);
|
private DateTime _DTS = new DateTime();
|
||||||
return _Config;
|
public DateTime DTS
|
||||||
}
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
private DateTime _DTS = new DateTime();
|
get
|
||||||
public DateTime DTS
|
{
|
||||||
{
|
return _DTS;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
}
|
||||||
{
|
private string _UsrID = string.Empty;
|
||||||
CanReadProperty("DTS", true);
|
public string UsrID
|
||||||
return _DTS;
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
private string _UsrID = string.Empty;
|
{
|
||||||
public string UsrID
|
return _UsrID;
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
private int _GroupAssignmentCount = 0;
|
||||||
{
|
/// <summary>
|
||||||
CanReadProperty("UsrID", true);
|
/// Count of GroupAssignments for this Group
|
||||||
return _UsrID;
|
/// </summary>
|
||||||
}
|
public int GroupAssignmentCount
|
||||||
}
|
{
|
||||||
private int _GroupAssignmentCount = 0;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
/// <summary>
|
get
|
||||||
/// Count of GroupAssignments for this Group
|
{
|
||||||
/// </summary>
|
if (_GroupAssignmentCount < 0)
|
||||||
public int GroupAssignmentCount
|
_GroupAssignmentCount = GroupAssignments.Count;
|
||||||
{
|
return _GroupAssignmentCount;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
}
|
||||||
{
|
private AssignmentInfoList _GroupAssignments = null;
|
||||||
CanReadProperty("GroupAssignmentCount", true);
|
[TypeConverter(typeof(AssignmentInfoListConverter))]
|
||||||
if (_GroupAssignmentCount < 0)
|
public AssignmentInfoList GroupAssignments
|
||||||
_GroupAssignmentCount = GroupAssignments.Count;
|
{
|
||||||
return _GroupAssignmentCount;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
}
|
{
|
||||||
private AssignmentInfoList _GroupAssignments = null;
|
if (_GroupAssignmentCount < 0 || (_GroupAssignmentCount > 0 && _GroupAssignments == null))
|
||||||
[TypeConverter(typeof(AssignmentInfoListConverter))]
|
_GroupAssignments = AssignmentInfoList.GetByGID(_GID);
|
||||||
public AssignmentInfoList GroupAssignments
|
if (_GroupAssignmentCount < 0)
|
||||||
{
|
_GroupAssignmentCount = _GroupAssignments.Count;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
return _GroupAssignments;
|
||||||
get
|
}
|
||||||
{
|
}
|
||||||
CanReadProperty("GroupAssignments", true);
|
public void RefreshGroupAssignments()
|
||||||
if (_GroupAssignmentCount < 0 || (_GroupAssignmentCount > 0 && _GroupAssignments == null))
|
{
|
||||||
_GroupAssignments = AssignmentInfoList.GetByGID(_GID);
|
_GroupAssignmentCount = -1;
|
||||||
if (_GroupAssignmentCount < 0)
|
ConvertListToDictionary();
|
||||||
_GroupAssignmentCount = _GroupAssignments.Count;
|
if (_CacheByPrimaryKey.ContainsKey(_GID.ToString()))
|
||||||
return _GroupAssignments;
|
foreach (GroupInfo tmp in _CacheByPrimaryKey[_GID.ToString()])
|
||||||
}
|
tmp._GroupAssignmentCount = -1; // This will cause the data to be requeried
|
||||||
}
|
}
|
||||||
public void RefreshGroupAssignments()
|
private int _GroupMembershipCount = 0;
|
||||||
{
|
/// <summary>
|
||||||
_GroupAssignmentCount = -1;
|
/// Count of GroupMemberships for this Group
|
||||||
ConvertListToDictionary();
|
/// </summary>
|
||||||
if (_CacheByPrimaryKey.ContainsKey(_GID.ToString()))
|
public int GroupMembershipCount
|
||||||
foreach (GroupInfo tmp in _CacheByPrimaryKey[_GID.ToString()])
|
{
|
||||||
tmp._GroupAssignmentCount = -1; // This will cause the data to be requeried
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
private int _GroupMembershipCount = 0;
|
{
|
||||||
/// <summary>
|
if (_GroupMembershipCount < 0)
|
||||||
/// Count of GroupMemberships for this Group
|
_GroupMembershipCount = GroupMemberships.Count;
|
||||||
/// </summary>
|
return _GroupMembershipCount;
|
||||||
public int GroupMembershipCount
|
}
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
private MembershipInfoList _GroupMemberships = null;
|
||||||
get
|
[TypeConverter(typeof(MembershipInfoListConverter))]
|
||||||
{
|
public MembershipInfoList GroupMemberships
|
||||||
CanReadProperty("GroupMembershipCount", true);
|
{
|
||||||
if (_GroupMembershipCount < 0)
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
_GroupMembershipCount = GroupMemberships.Count;
|
get
|
||||||
return _GroupMembershipCount;
|
{
|
||||||
}
|
if (_GroupMembershipCount < 0 || (_GroupMembershipCount > 0 && _GroupMemberships == null))
|
||||||
}
|
_GroupMemberships = MembershipInfoList.GetByGID(_GID);
|
||||||
private MembershipInfoList _GroupMemberships = null;
|
if (_GroupMembershipCount < 0)
|
||||||
[TypeConverter(typeof(MembershipInfoListConverter))]
|
_GroupMembershipCount = _GroupMemberships.Count;
|
||||||
public MembershipInfoList GroupMemberships
|
return _GroupMemberships;
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
public void RefreshGroupMemberships()
|
||||||
{
|
{
|
||||||
CanReadProperty("GroupMemberships", true);
|
_GroupMembershipCount = -1;
|
||||||
if (_GroupMembershipCount < 0 || (_GroupMembershipCount > 0 && _GroupMemberships == null))
|
ConvertListToDictionary();
|
||||||
_GroupMemberships = MembershipInfoList.GetByGID(_GID);
|
if (_CacheByPrimaryKey.ContainsKey(_GID.ToString()))
|
||||||
if (_GroupMembershipCount < 0)
|
foreach (GroupInfo tmp in _CacheByPrimaryKey[_GID.ToString()])
|
||||||
_GroupMembershipCount = _GroupMemberships.Count;
|
tmp._GroupMembershipCount = -1; // This will cause the data to be requeried
|
||||||
return _GroupMemberships;
|
}
|
||||||
}
|
// CSLATODO: Replace base GroupInfo.ToString function as necessary
|
||||||
}
|
/// <summary>
|
||||||
public void RefreshGroupMemberships()
|
/// Overrides Base ToString
|
||||||
{
|
/// </summary>
|
||||||
_GroupMembershipCount = -1;
|
/// <returns>A string representation of current GroupInfo</returns>
|
||||||
ConvertListToDictionary();
|
//public override string ToString()
|
||||||
if (_CacheByPrimaryKey.ContainsKey(_GID.ToString()))
|
//{
|
||||||
foreach (GroupInfo tmp in _CacheByPrimaryKey[_GID.ToString()])
|
// return base.ToString();
|
||||||
tmp._GroupMembershipCount = -1; // This will cause the data to be requeried
|
//}
|
||||||
}
|
// CSLATODO: Check GroupInfo.GetIdValue to assure that the ID returned is unique
|
||||||
// CSLATODO: Replace base GroupInfo.ToString function as necessary
|
/// <summary>
|
||||||
/// <summary>
|
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||||
/// Overrides Base ToString
|
/// </summary>
|
||||||
/// </summary>
|
/// <returns>A Unique ID for the current GroupInfo</returns>
|
||||||
/// <returns>A string representation of current GroupInfo</returns>
|
protected override object GetIdValue()
|
||||||
//public override string ToString()
|
{
|
||||||
//{
|
return MyGroupInfoUnique; // Absolutely Unique ID
|
||||||
// return base.ToString();
|
}
|
||||||
//}
|
#endregion
|
||||||
// CSLATODO: Check GroupInfo.GetIdValue to assure that the ID returned is unique
|
#region Factory Methods
|
||||||
/// <summary>
|
private static int _GroupInfoUnique = 0;
|
||||||
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
private static int GroupInfoUnique
|
||||||
/// </summary>
|
{ get { return ++_GroupInfoUnique; } }
|
||||||
/// <returns>A Unique ID for the current GroupInfo</returns>
|
private int _MyGroupInfoUnique = GroupInfoUnique;
|
||||||
protected override object GetIdValue()
|
public int MyGroupInfoUnique // Absolutely Unique ID - Info
|
||||||
{
|
{ get { return _MyGroupInfoUnique; } }
|
||||||
return MyGroupInfoUnique; // Absolutely Unique ID
|
protected GroupInfo()
|
||||||
}
|
{/* require use of factory methods */
|
||||||
#endregion
|
AddToCache(this);
|
||||||
#region Factory Methods
|
}
|
||||||
private static int _GroupInfoUnique = 0;
|
private bool _Disposed = false;
|
||||||
private static int GroupInfoUnique
|
private static int _CountCreated = 0;
|
||||||
{ get { return ++_GroupInfoUnique; } }
|
private static int _CountDisposed = 0;
|
||||||
private int _MyGroupInfoUnique = GroupInfoUnique;
|
private static int _CountFinalized = 0;
|
||||||
public int MyGroupInfoUnique // Absolutely Unique ID - Info
|
private static int IncrementCountCreated
|
||||||
{ get { return _MyGroupInfoUnique; } }
|
{ get { return ++_CountCreated; } }
|
||||||
protected GroupInfo()
|
private int _CountWhenCreated = IncrementCountCreated;
|
||||||
{/* require use of factory methods */
|
public static int CountCreated
|
||||||
AddToCache(this);
|
{ get { return _CountCreated; } }
|
||||||
}
|
public static int CountNotDisposed
|
||||||
private bool _Disposed = false;
|
{ get { return _CountCreated - _CountDisposed; } }
|
||||||
private static int _CountCreated = 0;
|
public static int CountNotFinalized
|
||||||
private static int _CountDisposed = 0;
|
{ get { return _CountCreated - _CountFinalized; } }
|
||||||
private static int _CountFinalized = 0;
|
~GroupInfo()
|
||||||
private static int IncrementCountCreated
|
{
|
||||||
{ get { return ++_CountCreated; } }
|
_CountFinalized++;
|
||||||
private int _CountWhenCreated = IncrementCountCreated;
|
}
|
||||||
public static int CountCreated
|
public void Dispose()
|
||||||
{ get { return _CountCreated; } }
|
{
|
||||||
public static int CountNotDisposed
|
if (_Disposed) return;
|
||||||
{ get { return _CountCreated - _CountDisposed; } }
|
_CountDisposed++;
|
||||||
public static int CountNotFinalized
|
_Disposed = true;
|
||||||
{ get { return _CountCreated - _CountFinalized; } }
|
RemoveFromCache(this);
|
||||||
~GroupInfo()
|
if (!_CacheByPrimaryKey.ContainsKey(GID.ToString())) return;
|
||||||
{
|
List<GroupInfo> listGroupInfo = _CacheByPrimaryKey[GID.ToString()]; // Get the list of items
|
||||||
_CountFinalized++;
|
while (listGroupInfo.Contains(this)) listGroupInfo.Remove(this); // Remove the item from the list
|
||||||
}
|
if (listGroupInfo.Count == 0) // If there are no items left in the list
|
||||||
public void Dispose()
|
_CacheByPrimaryKey.Remove(GID.ToString()); // remove the list
|
||||||
{
|
}
|
||||||
if (_Disposed) return;
|
public virtual Group Get()
|
||||||
_CountDisposed++;
|
{
|
||||||
_Disposed = true;
|
return _Editable = Group.Get(_GID);
|
||||||
RemoveFromCache(this);
|
}
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(GID.ToString())) return;
|
public static void Refresh(Group tmp)
|
||||||
List<GroupInfo> listGroupInfo = _CacheByPrimaryKey[GID.ToString()]; // Get the list of items
|
{
|
||||||
while (listGroupInfo.Contains(this)) listGroupInfo.Remove(this); // Remove the item from the list
|
string key = tmp.GID.ToString();
|
||||||
if (listGroupInfo.Count == 0) // If there are no items left in the list
|
ConvertListToDictionary();
|
||||||
_CacheByPrimaryKey.Remove(GID.ToString()); // remove the list
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
}
|
foreach (GroupInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
public virtual Group Get()
|
tmpInfo.RefreshFields(tmp);
|
||||||
{
|
}
|
||||||
return _Editable = Group.Get(_GID);
|
protected virtual void RefreshFields(Group tmp)
|
||||||
}
|
{
|
||||||
public static void Refresh(Group tmp)
|
_GroupName = tmp.GroupName;
|
||||||
{
|
_GroupType = tmp.GroupType;
|
||||||
string key = tmp.GID.ToString();
|
_Config = tmp.Config;
|
||||||
ConvertListToDictionary();
|
_DTS = tmp.DTS;
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
_UsrID = tmp.UsrID;
|
||||||
foreach (GroupInfo tmpInfo in _CacheByPrimaryKey[key])
|
_GroupInfoExtension.Refresh(this);
|
||||||
tmpInfo.RefreshFields(tmp);
|
OnChange();// raise an event
|
||||||
}
|
}
|
||||||
protected virtual void RefreshFields(Group tmp)
|
public static GroupInfo Get(int gid)
|
||||||
{
|
{
|
||||||
_GroupName = tmp.GroupName;
|
//if (!CanGetObject())
|
||||||
_GroupType = tmp.GroupType;
|
// throw new System.Security.SecurityException("User not authorized to view a Group");
|
||||||
_Config = tmp.Config;
|
try
|
||||||
_DTS = tmp.DTS;
|
{
|
||||||
_UsrID = tmp.UsrID;
|
GroupInfo tmp = GetCachedByPrimaryKey(gid);
|
||||||
_GroupInfoExtension.Refresh(this);
|
if (tmp == null)
|
||||||
OnChange();// raise an event
|
{
|
||||||
}
|
tmp = DataPortal.Fetch<GroupInfo>(new PKCriteria(gid));
|
||||||
public static GroupInfo Get(int gid)
|
AddToCache(tmp);
|
||||||
{
|
}
|
||||||
//if (!CanGetObject())
|
if (tmp.ErrorMessage == "No Record Found")
|
||||||
// throw new System.Security.SecurityException("User not authorized to view a Group");
|
{
|
||||||
try
|
tmp.Dispose(); // Clean-up GroupInfo
|
||||||
{
|
tmp = null;
|
||||||
GroupInfo tmp = GetCachedByPrimaryKey(gid);
|
}
|
||||||
if (tmp == null)
|
return tmp;
|
||||||
{
|
}
|
||||||
tmp = DataPortal.Fetch<GroupInfo>(new PKCriteria(gid));
|
catch (Exception ex)
|
||||||
AddToCache(tmp);
|
{
|
||||||
}
|
throw new DbCslaException("Error on GroupInfo.Get", ex);
|
||||||
if (tmp.ErrorMessage == "No Record Found")
|
}
|
||||||
{
|
}
|
||||||
tmp.Dispose(); // Clean-up GroupInfo
|
#endregion
|
||||||
tmp = null;
|
#region Data Access Portal
|
||||||
}
|
internal GroupInfo(SafeDataReader dr)
|
||||||
return tmp;
|
{
|
||||||
}
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] GroupInfo.Constructor", GetHashCode());
|
||||||
catch (Exception ex)
|
try
|
||||||
{
|
{
|
||||||
throw new DbCslaException("Error on GroupInfo.Get", ex);
|
ReadData(dr);
|
||||||
}
|
}
|
||||||
}
|
catch (Exception ex)
|
||||||
#endregion
|
{
|
||||||
#region Data Access Portal
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("GroupInfo.Constructor", ex);
|
||||||
internal GroupInfo(SafeDataReader dr)
|
throw new DbCslaException("GroupInfo.Constructor", ex);
|
||||||
{
|
}
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] GroupInfo.Constructor", GetHashCode());
|
}
|
||||||
try
|
[Serializable()]
|
||||||
{
|
protected class PKCriteria
|
||||||
ReadData(dr);
|
{
|
||||||
}
|
private int _GID;
|
||||||
catch (Exception ex)
|
public int GID
|
||||||
{
|
{ get { return _GID; } }
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("GroupInfo.Constructor", ex);
|
public PKCriteria(int gid)
|
||||||
throw new DbCslaException("GroupInfo.Constructor", ex);
|
{
|
||||||
}
|
_GID = gid;
|
||||||
}
|
}
|
||||||
[Serializable()]
|
}
|
||||||
protected class PKCriteria
|
private void ReadData(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
private int _GID;
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] GroupInfo.ReadData", GetHashCode());
|
||||||
public int GID
|
try
|
||||||
{ get { return _GID; } }
|
{
|
||||||
public PKCriteria(int gid)
|
_GID = dr.GetInt32("GID");
|
||||||
{
|
_GroupName = dr.GetString("GroupName");
|
||||||
_GID = gid;
|
_GroupType = (int?)dr.GetValue("GroupType");
|
||||||
}
|
_Config = dr.GetString("Config");
|
||||||
}
|
_DTS = dr.GetDateTime("DTS");
|
||||||
private void ReadData(SafeDataReader dr)
|
_UsrID = dr.GetString("UsrID");
|
||||||
{
|
_GroupAssignmentCount = dr.GetInt32("AssignmentCount");
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] GroupInfo.ReadData", GetHashCode());
|
_GroupMembershipCount = dr.GetInt32("MembershipCount");
|
||||||
try
|
}
|
||||||
{
|
catch (Exception ex)
|
||||||
_GID = dr.GetInt32("GID");
|
{
|
||||||
_GroupName = dr.GetString("GroupName");
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("GroupInfo.ReadData", ex);
|
||||||
_GroupType = (int?)dr.GetValue("GroupType");
|
_ErrorMessage = ex.Message;
|
||||||
_Config = dr.GetString("Config");
|
throw new DbCslaException("GroupInfo.ReadData", ex);
|
||||||
_DTS = dr.GetDateTime("DTS");
|
}
|
||||||
_UsrID = dr.GetString("UsrID");
|
}
|
||||||
_GroupAssignmentCount = dr.GetInt32("AssignmentCount");
|
private void DataPortal_Fetch(PKCriteria criteria)
|
||||||
_GroupMembershipCount = dr.GetInt32("MembershipCount");
|
{
|
||||||
}
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] GroupInfo.DataPortal_Fetch", GetHashCode());
|
||||||
catch (Exception ex)
|
try
|
||||||
{
|
{
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("GroupInfo.ReadData", ex);
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
_ErrorMessage = ex.Message;
|
{
|
||||||
throw new DbCslaException("GroupInfo.ReadData", ex);
|
ApplicationContext.LocalContext["cn"] = cn;
|
||||||
}
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
}
|
{
|
||||||
private void DataPortal_Fetch(PKCriteria criteria)
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
{
|
cm.CommandText = "getGroup";
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] GroupInfo.DataPortal_Fetch", GetHashCode());
|
cm.Parameters.AddWithValue("@GID", criteria.GID);
|
||||||
try
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
{
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
{
|
||||||
{
|
if (!dr.Read())
|
||||||
ApplicationContext.LocalContext["cn"] = cn;
|
{
|
||||||
using (SqlCommand cm = cn.CreateCommand())
|
_ErrorMessage = "No Record Found";
|
||||||
{
|
return;
|
||||||
cm.CommandType = CommandType.StoredProcedure;
|
}
|
||||||
cm.CommandText = "getGroup";
|
ReadData(dr);
|
||||||
cm.Parameters.AddWithValue("@GID", criteria.GID);
|
}
|
||||||
cm.CommandTimeout = Database.DefaultTimeout;
|
}
|
||||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
// removing of item only needed for local data portal
|
||||||
{
|
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
||||||
if (!dr.Read())
|
ApplicationContext.LocalContext.Remove("cn");
|
||||||
{
|
}
|
||||||
_ErrorMessage = "No Record Found";
|
}
|
||||||
return;
|
catch (Exception ex)
|
||||||
}
|
{
|
||||||
ReadData(dr);
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("GroupInfo.DataPortal_Fetch", ex);
|
||||||
}
|
_ErrorMessage = ex.Message;
|
||||||
}
|
throw new DbCslaException("GroupInfo.DataPortal_Fetch", ex);
|
||||||
// removing of item only needed for local data portal
|
}
|
||||||
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
}
|
||||||
ApplicationContext.LocalContext.Remove("cn");
|
#endregion
|
||||||
}
|
// Standard Refresh
|
||||||
}
|
#region extension
|
||||||
catch (Exception ex)
|
GroupInfoExtension _GroupInfoExtension = new GroupInfoExtension();
|
||||||
{
|
[Serializable()]
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("GroupInfo.DataPortal_Fetch", ex);
|
partial class GroupInfoExtension : extensionBase { }
|
||||||
_ErrorMessage = ex.Message;
|
[Serializable()]
|
||||||
throw new DbCslaException("GroupInfo.DataPortal_Fetch", ex);
|
class extensionBase
|
||||||
}
|
{
|
||||||
}
|
// Default Refresh
|
||||||
#endregion
|
public virtual void Refresh(GroupInfo tmp) { }
|
||||||
// Standard Refresh
|
}
|
||||||
#region extension
|
#endregion
|
||||||
GroupInfoExtension _GroupInfoExtension = new GroupInfoExtension();
|
} // Class
|
||||||
[Serializable()]
|
#region Converter
|
||||||
partial class GroupInfoExtension : extensionBase { }
|
internal class GroupInfoConverter : ExpandableObjectConverter
|
||||||
[Serializable()]
|
{
|
||||||
class extensionBase
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
{
|
{
|
||||||
// Default Refresh
|
if (destType == typeof(string) && value is GroupInfo)
|
||||||
public virtual void Refresh(GroupInfo tmp) { }
|
{
|
||||||
}
|
// Return the ToString value
|
||||||
#endregion
|
return ((GroupInfo)value).ToString();
|
||||||
} // Class
|
}
|
||||||
#region Converter
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
internal class GroupInfoConverter : ExpandableObjectConverter
|
}
|
||||||
{
|
}
|
||||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
#endregion
|
||||||
{
|
|
||||||
if (destType == typeof(string) && value is GroupInfo)
|
|
||||||
{
|
|
||||||
// Return the ToString value
|
|
||||||
return ((GroupInfo)value).ToString();
|
|
||||||
}
|
|
||||||
return base.ConvertTo(context, culture, value, destType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -19,385 +19,376 @@ using System.ComponentModel;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
public delegate void ImageAuditInfoEvent(object sender);
|
public delegate void ImageAuditInfoEvent(object sender);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ImageAuditInfo Generated by MyGeneration using the CSLA Object Mapping template
|
/// ImageAuditInfo Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
[TypeConverter(typeof(ImageAuditInfoConverter))]
|
[TypeConverter(typeof(ImageAuditInfoConverter))]
|
||||||
public partial class ImageAuditInfo : ReadOnlyBase<ImageAuditInfo>, IDisposable
|
public partial class ImageAuditInfo : ReadOnlyBase<ImageAuditInfo>, IDisposable
|
||||||
{
|
{
|
||||||
public event ImageAuditInfoEvent Changed;
|
public event ImageAuditInfoEvent Changed;
|
||||||
private void OnChange()
|
private void OnChange()
|
||||||
{
|
{
|
||||||
if (Changed != null) Changed(this);
|
if (Changed != null) Changed(this);
|
||||||
}
|
}
|
||||||
#region Log4Net
|
#region Log4Net
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
private static List<ImageAuditInfo> _CacheList = new List<ImageAuditInfo>();
|
private static List<ImageAuditInfo> _CacheList = new List<ImageAuditInfo>();
|
||||||
protected static void AddToCache(ImageAuditInfo imageAuditInfo)
|
protected static void AddToCache(ImageAuditInfo imageAuditInfo)
|
||||||
{
|
{
|
||||||
if (!_CacheList.Contains(imageAuditInfo)) _CacheList.Add(imageAuditInfo); // In AddToCache
|
if (!_CacheList.Contains(imageAuditInfo)) _CacheList.Add(imageAuditInfo); // In AddToCache
|
||||||
}
|
}
|
||||||
protected static void RemoveFromCache(ImageAuditInfo imageAuditInfo)
|
protected static void RemoveFromCache(ImageAuditInfo imageAuditInfo)
|
||||||
{
|
{
|
||||||
while (_CacheList.Contains(imageAuditInfo)) _CacheList.Remove(imageAuditInfo); // In RemoveFromCache
|
while (_CacheList.Contains(imageAuditInfo)) _CacheList.Remove(imageAuditInfo); // In RemoveFromCache
|
||||||
}
|
}
|
||||||
private static Dictionary<string, List<ImageAuditInfo>> _CacheByPrimaryKey = new Dictionary<string, List<ImageAuditInfo>>();
|
private static Dictionary<string, List<ImageAuditInfo>> _CacheByPrimaryKey = new Dictionary<string, List<ImageAuditInfo>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
while (_CacheList.Count > 0) // Move ImageAuditInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
while (_CacheList.Count > 0) // Move ImageAuditInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
||||||
{
|
{
|
||||||
ImageAuditInfo tmp = _CacheList[0]; // Get the first ImageAuditInfo
|
ImageAuditInfo tmp = _CacheList[0]; // Get the first ImageAuditInfo
|
||||||
string pKey = tmp.AuditID.ToString();
|
string pKey = tmp.AuditID.ToString();
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
||||||
{
|
{
|
||||||
_CacheByPrimaryKey[pKey] = new List<ImageAuditInfo>(); // Add new list for PrimaryKey
|
_CacheByPrimaryKey[pKey] = new List<ImageAuditInfo>(); // Add new list for PrimaryKey
|
||||||
}
|
}
|
||||||
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
||||||
_CacheList.RemoveAt(0); // Remove the first ImageAuditInfo
|
_CacheList.RemoveAt(0); // Remove the first ImageAuditInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
internal static void AddList(ImageAuditInfoList lst)
|
internal static void AddList(ImageAuditInfoList lst)
|
||||||
{
|
{
|
||||||
foreach (ImageAuditInfo item in lst) AddToCache(item);
|
foreach (ImageAuditInfo item in lst) AddToCache(item);
|
||||||
}
|
}
|
||||||
protected static ImageAuditInfo GetCachedByPrimaryKey(long auditID)
|
protected static ImageAuditInfo GetCachedByPrimaryKey(long auditID)
|
||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = auditID.ToString();
|
string key = auditID.ToString();
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Business Methods
|
#region Business Methods
|
||||||
private string _ErrorMessage = string.Empty;
|
private string _ErrorMessage = string.Empty;
|
||||||
public string ErrorMessage
|
public string ErrorMessage
|
||||||
{
|
{
|
||||||
get { return _ErrorMessage; }
|
get { return _ErrorMessage; }
|
||||||
}
|
}
|
||||||
protected ImageAudit _Editable;
|
protected ImageAudit _Editable;
|
||||||
private IVEHasBrokenRules HasBrokenRules
|
private IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
IVEHasBrokenRules hasBrokenRules = null;
|
IVEHasBrokenRules hasBrokenRules = null;
|
||||||
if (_Editable != null)
|
if (_Editable != null)
|
||||||
hasBrokenRules = _Editable.HasBrokenRules;
|
hasBrokenRules = _Editable.HasBrokenRules;
|
||||||
return hasBrokenRules;
|
return hasBrokenRules;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private long _AuditID;
|
private long _AuditID;
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
public long AuditID
|
public long AuditID
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("AuditID", true);
|
return _AuditID;
|
||||||
return _AuditID;
|
}
|
||||||
}
|
}
|
||||||
}
|
private int _ContentID;
|
||||||
private int _ContentID;
|
public int ContentID
|
||||||
public int ContentID
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
get
|
||||||
get
|
{
|
||||||
{
|
return _ContentID;
|
||||||
CanReadProperty("ContentID", true);
|
}
|
||||||
return _ContentID;
|
}
|
||||||
}
|
private int _ImageType;
|
||||||
}
|
public int ImageType
|
||||||
private int _ImageType;
|
{
|
||||||
public int ImageType
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
return _ImageType;
|
||||||
{
|
}
|
||||||
CanReadProperty("ImageType", true);
|
}
|
||||||
return _ImageType;
|
private string _FileName = string.Empty;
|
||||||
}
|
public string FileName
|
||||||
}
|
{
|
||||||
private string _FileName = string.Empty;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
public string FileName
|
get
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
return _FileName;
|
||||||
get
|
}
|
||||||
{
|
}
|
||||||
CanReadProperty("FileName", true);
|
private byte[] _Data;
|
||||||
return _FileName;
|
public byte[] Data
|
||||||
}
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
private byte[] _Data;
|
get
|
||||||
public byte[] Data
|
{
|
||||||
{
|
return _Data;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
}
|
||||||
{
|
private string _Config = string.Empty;
|
||||||
CanReadProperty("Data", true);
|
public string Config
|
||||||
return _Data;
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
private string _Config = string.Empty;
|
{
|
||||||
public string Config
|
return _Config;
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
private DateTime _DTS = new DateTime();
|
||||||
{
|
public DateTime DTS
|
||||||
CanReadProperty("Config", true);
|
{
|
||||||
return _Config;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
}
|
{
|
||||||
private DateTime _DTS = new DateTime();
|
return _DTS;
|
||||||
public DateTime DTS
|
}
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
private string _UserID = string.Empty;
|
||||||
get
|
public string UserID
|
||||||
{
|
{
|
||||||
CanReadProperty("DTS", true);
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
return _DTS;
|
get
|
||||||
}
|
{
|
||||||
}
|
return _UserID;
|
||||||
private string _UserID = string.Empty;
|
}
|
||||||
public string UserID
|
}
|
||||||
{
|
private int _DeleteStatus;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
public int DeleteStatus
|
||||||
get
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
CanReadProperty("UserID", true);
|
get
|
||||||
return _UserID;
|
{
|
||||||
}
|
return _DeleteStatus;
|
||||||
}
|
}
|
||||||
private int _DeleteStatus;
|
}
|
||||||
public int DeleteStatus
|
// CSLATODO: Replace base ImageAuditInfo.ToString function as necessary
|
||||||
{
|
/// <summary>
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
/// Overrides Base ToString
|
||||||
get
|
/// </summary>
|
||||||
{
|
/// <returns>A string representation of current ImageAuditInfo</returns>
|
||||||
CanReadProperty("DeleteStatus", true);
|
//public override string ToString()
|
||||||
return _DeleteStatus;
|
//{
|
||||||
}
|
// return base.ToString();
|
||||||
}
|
//}
|
||||||
// CSLATODO: Replace base ImageAuditInfo.ToString function as necessary
|
// CSLATODO: Check ImageAuditInfo.GetIdValue to assure that the ID returned is unique
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Overrides Base ToString
|
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>A string representation of current ImageAuditInfo</returns>
|
/// <returns>A Unique ID for the current ImageAuditInfo</returns>
|
||||||
//public override string ToString()
|
protected override object GetIdValue()
|
||||||
//{
|
{
|
||||||
// return base.ToString();
|
return MyImageAuditInfoUnique; // Absolutely Unique ID
|
||||||
//}
|
}
|
||||||
// CSLATODO: Check ImageAuditInfo.GetIdValue to assure that the ID returned is unique
|
#endregion
|
||||||
/// <summary>
|
#region Factory Methods
|
||||||
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
private static int _ImageAuditInfoUnique = 0;
|
||||||
/// </summary>
|
private static int ImageAuditInfoUnique
|
||||||
/// <returns>A Unique ID for the current ImageAuditInfo</returns>
|
{ get { return ++_ImageAuditInfoUnique; } }
|
||||||
protected override object GetIdValue()
|
private int _MyImageAuditInfoUnique = ImageAuditInfoUnique;
|
||||||
{
|
public int MyImageAuditInfoUnique // Absolutely Unique ID - Info
|
||||||
return MyImageAuditInfoUnique; // Absolutely Unique ID
|
{ get { return _MyImageAuditInfoUnique; } }
|
||||||
}
|
protected ImageAuditInfo()
|
||||||
#endregion
|
{/* require use of factory methods */
|
||||||
#region Factory Methods
|
AddToCache(this);
|
||||||
private static int _ImageAuditInfoUnique = 0;
|
}
|
||||||
private static int ImageAuditInfoUnique
|
private bool _Disposed = false;
|
||||||
{ get { return ++_ImageAuditInfoUnique; } }
|
private static int _CountCreated = 0;
|
||||||
private int _MyImageAuditInfoUnique = ImageAuditInfoUnique;
|
private static int _CountDisposed = 0;
|
||||||
public int MyImageAuditInfoUnique // Absolutely Unique ID - Info
|
private static int _CountFinalized = 0;
|
||||||
{ get { return _MyImageAuditInfoUnique; } }
|
private static int IncrementCountCreated
|
||||||
protected ImageAuditInfo()
|
{ get { return ++_CountCreated; } }
|
||||||
{/* require use of factory methods */
|
private int _CountWhenCreated = IncrementCountCreated;
|
||||||
AddToCache(this);
|
public static int CountCreated
|
||||||
}
|
{ get { return _CountCreated; } }
|
||||||
private bool _Disposed = false;
|
public static int CountNotDisposed
|
||||||
private static int _CountCreated = 0;
|
{ get { return _CountCreated - _CountDisposed; } }
|
||||||
private static int _CountDisposed = 0;
|
public static int CountNotFinalized
|
||||||
private static int _CountFinalized = 0;
|
{ get { return _CountCreated - _CountFinalized; } }
|
||||||
private static int IncrementCountCreated
|
~ImageAuditInfo()
|
||||||
{ get { return ++_CountCreated; } }
|
{
|
||||||
private int _CountWhenCreated = IncrementCountCreated;
|
_CountFinalized++;
|
||||||
public static int CountCreated
|
}
|
||||||
{ get { return _CountCreated; } }
|
public void Dispose()
|
||||||
public static int CountNotDisposed
|
{
|
||||||
{ get { return _CountCreated - _CountDisposed; } }
|
if (_Disposed) return;
|
||||||
public static int CountNotFinalized
|
_CountDisposed++;
|
||||||
{ get { return _CountCreated - _CountFinalized; } }
|
_Disposed = true;
|
||||||
~ImageAuditInfo()
|
RemoveFromCache(this);
|
||||||
{
|
if (!_CacheByPrimaryKey.ContainsKey(AuditID.ToString())) return;
|
||||||
_CountFinalized++;
|
List<ImageAuditInfo> listImageAuditInfo = _CacheByPrimaryKey[AuditID.ToString()]; // Get the list of items
|
||||||
}
|
while (listImageAuditInfo.Contains(this)) listImageAuditInfo.Remove(this); // Remove the item from the list
|
||||||
public void Dispose()
|
if (listImageAuditInfo.Count == 0) // If there are no items left in the list
|
||||||
{
|
_CacheByPrimaryKey.Remove(AuditID.ToString()); // remove the list
|
||||||
if (_Disposed) return;
|
}
|
||||||
_CountDisposed++;
|
public virtual ImageAudit Get()
|
||||||
_Disposed = true;
|
{
|
||||||
RemoveFromCache(this);
|
return _Editable = ImageAudit.Get(_AuditID);
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(AuditID.ToString())) return;
|
}
|
||||||
List<ImageAuditInfo> listImageAuditInfo = _CacheByPrimaryKey[AuditID.ToString()]; // Get the list of items
|
public static void Refresh(ImageAudit tmp)
|
||||||
while (listImageAuditInfo.Contains(this)) listImageAuditInfo.Remove(this); // Remove the item from the list
|
{
|
||||||
if (listImageAuditInfo.Count == 0) // If there are no items left in the list
|
string key = tmp.AuditID.ToString();
|
||||||
_CacheByPrimaryKey.Remove(AuditID.ToString()); // remove the list
|
ConvertListToDictionary();
|
||||||
}
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
public virtual ImageAudit Get()
|
foreach (ImageAuditInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
{
|
tmpInfo.RefreshFields(tmp);
|
||||||
return _Editable = ImageAudit.Get(_AuditID);
|
}
|
||||||
}
|
protected virtual void RefreshFields(ImageAudit tmp)
|
||||||
public static void Refresh(ImageAudit tmp)
|
{
|
||||||
{
|
_ContentID = tmp.ContentID;
|
||||||
string key = tmp.AuditID.ToString();
|
_ImageType = tmp.ImageType;
|
||||||
ConvertListToDictionary();
|
_FileName = tmp.FileName;
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
_Data = tmp.Data;
|
||||||
foreach (ImageAuditInfo tmpInfo in _CacheByPrimaryKey[key])
|
_Config = tmp.Config;
|
||||||
tmpInfo.RefreshFields(tmp);
|
_DTS = tmp.DTS;
|
||||||
}
|
_UserID = tmp.UserID;
|
||||||
protected virtual void RefreshFields(ImageAudit tmp)
|
_DeleteStatus = tmp.DeleteStatus;
|
||||||
{
|
_ImageAuditInfoExtension.Refresh(this);
|
||||||
_ContentID = tmp.ContentID;
|
OnChange();// raise an event
|
||||||
_ImageType = tmp.ImageType;
|
}
|
||||||
_FileName = tmp.FileName;
|
public static ImageAuditInfo Get(long auditID)
|
||||||
_Data = tmp.Data;
|
{
|
||||||
_Config = tmp.Config;
|
//if (!CanGetObject())
|
||||||
_DTS = tmp.DTS;
|
// throw new System.Security.SecurityException("User not authorized to view a ImageAudit");
|
||||||
_UserID = tmp.UserID;
|
try
|
||||||
_DeleteStatus = tmp.DeleteStatus;
|
{
|
||||||
_ImageAuditInfoExtension.Refresh(this);
|
ImageAuditInfo tmp = GetCachedByPrimaryKey(auditID);
|
||||||
OnChange();// raise an event
|
if (tmp == null)
|
||||||
}
|
{
|
||||||
public static ImageAuditInfo Get(long auditID)
|
tmp = DataPortal.Fetch<ImageAuditInfo>(new PKCriteria(auditID));
|
||||||
{
|
AddToCache(tmp);
|
||||||
//if (!CanGetObject())
|
}
|
||||||
// throw new System.Security.SecurityException("User not authorized to view a ImageAudit");
|
if (tmp.ErrorMessage == "No Record Found")
|
||||||
try
|
{
|
||||||
{
|
tmp.Dispose(); // Clean-up ImageAuditInfo
|
||||||
ImageAuditInfo tmp = GetCachedByPrimaryKey(auditID);
|
tmp = null;
|
||||||
if (tmp == null)
|
}
|
||||||
{
|
return tmp;
|
||||||
tmp = DataPortal.Fetch<ImageAuditInfo>(new PKCriteria(auditID));
|
}
|
||||||
AddToCache(tmp);
|
catch (Exception ex)
|
||||||
}
|
{
|
||||||
if (tmp.ErrorMessage == "No Record Found")
|
throw new DbCslaException("Error on ImageAuditInfo.Get", ex);
|
||||||
{
|
}
|
||||||
tmp.Dispose(); // Clean-up ImageAuditInfo
|
}
|
||||||
tmp = null;
|
#endregion
|
||||||
}
|
#region Data Access Portal
|
||||||
return tmp;
|
internal ImageAuditInfo(SafeDataReader dr)
|
||||||
}
|
{
|
||||||
catch (Exception ex)
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ImageAuditInfo.Constructor", GetHashCode());
|
||||||
{
|
try
|
||||||
throw new DbCslaException("Error on ImageAuditInfo.Get", ex);
|
{
|
||||||
}
|
ReadData(dr);
|
||||||
}
|
}
|
||||||
#endregion
|
catch (Exception ex)
|
||||||
#region Data Access Portal
|
{
|
||||||
internal ImageAuditInfo(SafeDataReader dr)
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("ImageAuditInfo.Constructor", ex);
|
||||||
{
|
throw new DbCslaException("ImageAuditInfo.Constructor", ex);
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ImageAuditInfo.Constructor", GetHashCode());
|
}
|
||||||
try
|
}
|
||||||
{
|
[Serializable()]
|
||||||
ReadData(dr);
|
protected class PKCriteria
|
||||||
}
|
{
|
||||||
catch (Exception ex)
|
private long _AuditID;
|
||||||
{
|
public long AuditID
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ImageAuditInfo.Constructor", ex);
|
{ get { return _AuditID; } }
|
||||||
throw new DbCslaException("ImageAuditInfo.Constructor", ex);
|
public PKCriteria(long auditID)
|
||||||
}
|
{
|
||||||
}
|
_AuditID = auditID;
|
||||||
[Serializable()]
|
}
|
||||||
protected class PKCriteria
|
}
|
||||||
{
|
private void ReadData(SafeDataReader dr)
|
||||||
private long _AuditID;
|
{
|
||||||
public long AuditID
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ImageAuditInfo.ReadData", GetHashCode());
|
||||||
{ get { return _AuditID; } }
|
try
|
||||||
public PKCriteria(long auditID)
|
{
|
||||||
{
|
_AuditID = dr.GetInt64("AuditID");
|
||||||
_AuditID = auditID;
|
_ContentID = dr.GetInt32("ContentID");
|
||||||
}
|
_ImageType = dr.GetInt32("ImageType");
|
||||||
}
|
_FileName = dr.GetString("FileName");
|
||||||
private void ReadData(SafeDataReader dr)
|
_Data = (byte[])dr.GetValue("Data");
|
||||||
{
|
_Config = dr.GetString("Config");
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ImageAuditInfo.ReadData", GetHashCode());
|
_DTS = dr.GetDateTime("DTS");
|
||||||
try
|
_UserID = dr.GetString("UserID");
|
||||||
{
|
_DeleteStatus = dr.GetInt32("DeleteStatus");
|
||||||
_AuditID = dr.GetInt64("AuditID");
|
}
|
||||||
_ContentID = dr.GetInt32("ContentID");
|
catch (Exception ex)
|
||||||
_ImageType = dr.GetInt32("ImageType");
|
{
|
||||||
_FileName = dr.GetString("FileName");
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("ImageAuditInfo.ReadData", ex);
|
||||||
_Data = (byte[])dr.GetValue("Data");
|
_ErrorMessage = ex.Message;
|
||||||
_Config = dr.GetString("Config");
|
throw new DbCslaException("ImageAuditInfo.ReadData", ex);
|
||||||
_DTS = dr.GetDateTime("DTS");
|
}
|
||||||
_UserID = dr.GetString("UserID");
|
}
|
||||||
_DeleteStatus = dr.GetInt32("DeleteStatus");
|
private void DataPortal_Fetch(PKCriteria criteria)
|
||||||
}
|
{
|
||||||
catch (Exception ex)
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ImageAuditInfo.DataPortal_Fetch", GetHashCode());
|
||||||
{
|
try
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ImageAuditInfo.ReadData", ex);
|
{
|
||||||
_ErrorMessage = ex.Message;
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
throw new DbCslaException("ImageAuditInfo.ReadData", ex);
|
{
|
||||||
}
|
ApplicationContext.LocalContext["cn"] = cn;
|
||||||
}
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
private void DataPortal_Fetch(PKCriteria criteria)
|
{
|
||||||
{
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ImageAuditInfo.DataPortal_Fetch", GetHashCode());
|
cm.CommandText = "getImageAudit";
|
||||||
try
|
cm.Parameters.AddWithValue("@AuditID", criteria.AuditID);
|
||||||
{
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
{
|
{
|
||||||
ApplicationContext.LocalContext["cn"] = cn;
|
if (!dr.Read())
|
||||||
using (SqlCommand cm = cn.CreateCommand())
|
{
|
||||||
{
|
_ErrorMessage = "No Record Found";
|
||||||
cm.CommandType = CommandType.StoredProcedure;
|
return;
|
||||||
cm.CommandText = "getImageAudit";
|
}
|
||||||
cm.Parameters.AddWithValue("@AuditID", criteria.AuditID);
|
ReadData(dr);
|
||||||
cm.CommandTimeout = Database.DefaultTimeout;
|
}
|
||||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
}
|
||||||
{
|
// removing of item only needed for local data portal
|
||||||
if (!dr.Read())
|
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
||||||
{
|
ApplicationContext.LocalContext.Remove("cn");
|
||||||
_ErrorMessage = "No Record Found";
|
}
|
||||||
return;
|
}
|
||||||
}
|
catch (Exception ex)
|
||||||
ReadData(dr);
|
{
|
||||||
}
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("ImageAuditInfo.DataPortal_Fetch", ex);
|
||||||
}
|
_ErrorMessage = ex.Message;
|
||||||
// removing of item only needed for local data portal
|
throw new DbCslaException("ImageAuditInfo.DataPortal_Fetch", ex);
|
||||||
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
}
|
||||||
ApplicationContext.LocalContext.Remove("cn");
|
}
|
||||||
}
|
#endregion
|
||||||
}
|
// Standard Refresh
|
||||||
catch (Exception ex)
|
#region extension
|
||||||
{
|
ImageAuditInfoExtension _ImageAuditInfoExtension = new ImageAuditInfoExtension();
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ImageAuditInfo.DataPortal_Fetch", ex);
|
[Serializable()]
|
||||||
_ErrorMessage = ex.Message;
|
partial class ImageAuditInfoExtension : extensionBase { }
|
||||||
throw new DbCslaException("ImageAuditInfo.DataPortal_Fetch", ex);
|
[Serializable()]
|
||||||
}
|
class extensionBase
|
||||||
}
|
{
|
||||||
#endregion
|
// Default Refresh
|
||||||
// Standard Refresh
|
public virtual void Refresh(ImageAuditInfo tmp) { }
|
||||||
#region extension
|
}
|
||||||
ImageAuditInfoExtension _ImageAuditInfoExtension = new ImageAuditInfoExtension();
|
#endregion
|
||||||
[Serializable()]
|
} // Class
|
||||||
partial class ImageAuditInfoExtension : extensionBase { }
|
#region Converter
|
||||||
[Serializable()]
|
internal class ImageAuditInfoConverter : ExpandableObjectConverter
|
||||||
class extensionBase
|
{
|
||||||
{
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
// Default Refresh
|
{
|
||||||
public virtual void Refresh(ImageAuditInfo tmp) { }
|
if (destType == typeof(string) && value is ImageAuditInfo)
|
||||||
}
|
{
|
||||||
#endregion
|
// Return the ToString value
|
||||||
} // Class
|
return ((ImageAuditInfo)value).ToString();
|
||||||
#region Converter
|
}
|
||||||
internal class ImageAuditInfoConverter : ExpandableObjectConverter
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
{
|
}
|
||||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
}
|
||||||
{
|
#endregion
|
||||||
if (destType == typeof(string) && value is ImageAuditInfo)
|
|
||||||
{
|
|
||||||
// Return the ToString value
|
|
||||||
return ((ImageAuditInfo)value).ToString();
|
|
||||||
}
|
|
||||||
return base.ConvertTo(context, culture, value, destType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
@ -19,381 +19,373 @@ using System.ComponentModel;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
public delegate void ImageInfoEvent(object sender);
|
public delegate void ImageInfoEvent(object sender);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ImageInfo Generated by MyGeneration using the CSLA Object Mapping template
|
/// ImageInfo Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
[TypeConverter(typeof(ImageInfoConverter))]
|
[TypeConverter(typeof(ImageInfoConverter))]
|
||||||
public partial class ImageInfo : ReadOnlyBase<ImageInfo>, IDisposable
|
public partial class ImageInfo : ReadOnlyBase<ImageInfo>, IDisposable
|
||||||
{
|
{
|
||||||
public event ImageInfoEvent Changed;
|
public event ImageInfoEvent Changed;
|
||||||
private void OnChange()
|
private void OnChange()
|
||||||
{
|
{
|
||||||
if (Changed != null) Changed(this);
|
if (Changed != null) Changed(this);
|
||||||
}
|
}
|
||||||
#region Log4Net
|
#region Log4Net
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
private static List<ImageInfo> _CacheList = new List<ImageInfo>();
|
private static List<ImageInfo> _CacheList = new List<ImageInfo>();
|
||||||
protected static void AddToCache(ImageInfo imageInfo)
|
protected static void AddToCache(ImageInfo imageInfo)
|
||||||
{
|
{
|
||||||
if (!_CacheList.Contains(imageInfo)) _CacheList.Add(imageInfo); // In AddToCache
|
if (!_CacheList.Contains(imageInfo)) _CacheList.Add(imageInfo); // In AddToCache
|
||||||
}
|
}
|
||||||
protected static void RemoveFromCache(ImageInfo imageInfo)
|
protected static void RemoveFromCache(ImageInfo imageInfo)
|
||||||
{
|
{
|
||||||
while (_CacheList.Contains(imageInfo)) _CacheList.Remove(imageInfo); // In RemoveFromCache
|
while (_CacheList.Contains(imageInfo)) _CacheList.Remove(imageInfo); // In RemoveFromCache
|
||||||
}
|
}
|
||||||
private static Dictionary<string, List<ImageInfo>> _CacheByPrimaryKey = new Dictionary<string, List<ImageInfo>>();
|
private static Dictionary<string, List<ImageInfo>> _CacheByPrimaryKey = new Dictionary<string, List<ImageInfo>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
while (_CacheList.Count > 0) // Move ImageInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
while (_CacheList.Count > 0) // Move ImageInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
||||||
{
|
{
|
||||||
ImageInfo tmp = _CacheList[0]; // Get the first ImageInfo
|
ImageInfo tmp = _CacheList[0]; // Get the first ImageInfo
|
||||||
string pKey = tmp.ContentID.ToString();
|
string pKey = tmp.ContentID.ToString();
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
||||||
{
|
{
|
||||||
_CacheByPrimaryKey[pKey] = new List<ImageInfo>(); // Add new list for PrimaryKey
|
_CacheByPrimaryKey[pKey] = new List<ImageInfo>(); // Add new list for PrimaryKey
|
||||||
}
|
}
|
||||||
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
||||||
_CacheList.RemoveAt(0); // Remove the first ImageInfo
|
_CacheList.RemoveAt(0); // Remove the first ImageInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
protected static ImageInfo GetCachedByPrimaryKey(int contentID)
|
protected static ImageInfo GetCachedByPrimaryKey(int contentID)
|
||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = contentID.ToString();
|
string key = contentID.ToString();
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Business Methods
|
#region Business Methods
|
||||||
private string _ErrorMessage = string.Empty;
|
private string _ErrorMessage = string.Empty;
|
||||||
public string ErrorMessage
|
public string ErrorMessage
|
||||||
{
|
{
|
||||||
get { return _ErrorMessage; }
|
get { return _ErrorMessage; }
|
||||||
}
|
}
|
||||||
protected Image _Editable;
|
protected Image _Editable;
|
||||||
private IVEHasBrokenRules HasBrokenRules
|
private IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
IVEHasBrokenRules hasBrokenRules = null;
|
IVEHasBrokenRules hasBrokenRules = null;
|
||||||
if (_Editable != null)
|
if (_Editable != null)
|
||||||
hasBrokenRules = _Editable.HasBrokenRules;
|
hasBrokenRules = _Editable.HasBrokenRules;
|
||||||
return hasBrokenRules;
|
return hasBrokenRules;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private int _ContentID;
|
private int _ContentID;
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
public int ContentID
|
public int ContentID
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("ContentID", true);
|
if (_MyContent != null) _ContentID = _MyContent.ContentID;
|
||||||
if (_MyContent != null) _ContentID = _MyContent.ContentID;
|
return _ContentID;
|
||||||
return _ContentID;
|
}
|
||||||
}
|
}
|
||||||
}
|
private ContentInfo _MyContent;
|
||||||
private ContentInfo _MyContent;
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
public ContentInfo MyContent
|
||||||
public ContentInfo MyContent
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
get
|
||||||
get
|
{
|
||||||
{
|
if (_MyContent == null && _ContentID != 0) _MyContent = ContentInfo.Get(_ContentID);
|
||||||
CanReadProperty("MyContent", true);
|
return _MyContent;
|
||||||
if (_MyContent == null && _ContentID != 0) _MyContent = ContentInfo.Get(_ContentID);
|
}
|
||||||
return _MyContent;
|
}
|
||||||
}
|
private int _ImageType;
|
||||||
}
|
/// <summary>
|
||||||
private int _ImageType;
|
/// 1 - Figure, 2 - Video, 3 - Audio
|
||||||
/// <summary>
|
/// </summary>
|
||||||
/// 1 - Figure, 2 - Video, 3 - Audio
|
public int ImageType
|
||||||
/// </summary>
|
{
|
||||||
public int ImageType
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
return _ImageType;
|
||||||
{
|
}
|
||||||
CanReadProperty("ImageType", true);
|
}
|
||||||
return _ImageType;
|
private string _FileName = string.Empty;
|
||||||
}
|
public string FileName
|
||||||
}
|
{
|
||||||
private string _FileName = string.Empty;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
public string FileName
|
get
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
return _FileName;
|
||||||
get
|
}
|
||||||
{
|
}
|
||||||
CanReadProperty("FileName", true);
|
private byte[] _Data;
|
||||||
return _FileName;
|
public byte[] Data
|
||||||
}
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
private byte[] _Data;
|
get
|
||||||
public byte[] Data
|
{
|
||||||
{
|
return _Data;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
}
|
||||||
{
|
private string _Config = string.Empty;
|
||||||
CanReadProperty("Data", true);
|
public string Config
|
||||||
return _Data;
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
private string _Config = string.Empty;
|
{
|
||||||
public string Config
|
return _Config;
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
private DateTime _DTS = new DateTime();
|
||||||
{
|
public DateTime DTS
|
||||||
CanReadProperty("Config", true);
|
{
|
||||||
return _Config;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
}
|
{
|
||||||
private DateTime _DTS = new DateTime();
|
return _DTS;
|
||||||
public DateTime DTS
|
}
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
private string _UserID = string.Empty;
|
||||||
get
|
public string UserID
|
||||||
{
|
{
|
||||||
CanReadProperty("DTS", true);
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
return _DTS;
|
get
|
||||||
}
|
{
|
||||||
}
|
return _UserID;
|
||||||
private string _UserID = string.Empty;
|
}
|
||||||
public string UserID
|
}
|
||||||
{
|
// CSLATODO: Replace base ImageInfo.ToString function as necessary
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
/// <summary>
|
||||||
get
|
/// Overrides Base ToString
|
||||||
{
|
/// </summary>
|
||||||
CanReadProperty("UserID", true);
|
/// <returns>A string representation of current ImageInfo</returns>
|
||||||
return _UserID;
|
//public override string ToString()
|
||||||
}
|
//{
|
||||||
}
|
// return base.ToString();
|
||||||
// CSLATODO: Replace base ImageInfo.ToString function as necessary
|
//}
|
||||||
/// <summary>
|
// CSLATODO: Check ImageInfo.GetIdValue to assure that the ID returned is unique
|
||||||
/// Overrides Base ToString
|
/// <summary>
|
||||||
/// </summary>
|
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||||
/// <returns>A string representation of current ImageInfo</returns>
|
/// </summary>
|
||||||
//public override string ToString()
|
/// <returns>A Unique ID for the current ImageInfo</returns>
|
||||||
//{
|
protected override object GetIdValue()
|
||||||
// return base.ToString();
|
{
|
||||||
//}
|
return MyImageInfoUnique; // Absolutely Unique ID
|
||||||
// CSLATODO: Check ImageInfo.GetIdValue to assure that the ID returned is unique
|
}
|
||||||
/// <summary>
|
#endregion
|
||||||
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
#region Factory Methods
|
||||||
/// </summary>
|
private static int _ImageInfoUnique = 0;
|
||||||
/// <returns>A Unique ID for the current ImageInfo</returns>
|
private static int ImageInfoUnique
|
||||||
protected override object GetIdValue()
|
{ get { return ++_ImageInfoUnique; } }
|
||||||
{
|
private int _MyImageInfoUnique = ImageInfoUnique;
|
||||||
return MyImageInfoUnique; // Absolutely Unique ID
|
public int MyImageInfoUnique // Absolutely Unique ID - Info
|
||||||
}
|
{ get { return _MyImageInfoUnique; } }
|
||||||
#endregion
|
protected ImageInfo()
|
||||||
#region Factory Methods
|
{/* require use of factory methods */
|
||||||
private static int _ImageInfoUnique = 0;
|
AddToCache(this);
|
||||||
private static int ImageInfoUnique
|
}
|
||||||
{ get { return ++_ImageInfoUnique; } }
|
private bool _Disposed = false;
|
||||||
private int _MyImageInfoUnique = ImageInfoUnique;
|
private static int _CountCreated = 0;
|
||||||
public int MyImageInfoUnique // Absolutely Unique ID - Info
|
private static int _CountDisposed = 0;
|
||||||
{ get { return _MyImageInfoUnique; } }
|
private static int _CountFinalized = 0;
|
||||||
protected ImageInfo()
|
private static int IncrementCountCreated
|
||||||
{/* require use of factory methods */
|
{ get { return ++_CountCreated; } }
|
||||||
AddToCache(this);
|
private int _CountWhenCreated = IncrementCountCreated;
|
||||||
}
|
public static int CountCreated
|
||||||
private bool _Disposed = false;
|
{ get { return _CountCreated; } }
|
||||||
private static int _CountCreated = 0;
|
public static int CountNotDisposed
|
||||||
private static int _CountDisposed = 0;
|
{ get { return _CountCreated - _CountDisposed; } }
|
||||||
private static int _CountFinalized = 0;
|
public static int CountNotFinalized
|
||||||
private static int IncrementCountCreated
|
{ get { return _CountCreated - _CountFinalized; } }
|
||||||
{ get { return ++_CountCreated; } }
|
~ImageInfo()
|
||||||
private int _CountWhenCreated = IncrementCountCreated;
|
{
|
||||||
public static int CountCreated
|
_CountFinalized++;
|
||||||
{ get { return _CountCreated; } }
|
}
|
||||||
public static int CountNotDisposed
|
public void Dispose()
|
||||||
{ get { return _CountCreated - _CountDisposed; } }
|
{
|
||||||
public static int CountNotFinalized
|
if (_Disposed) return;
|
||||||
{ get { return _CountCreated - _CountFinalized; } }
|
_CountDisposed++;
|
||||||
~ImageInfo()
|
_Disposed = true;
|
||||||
{
|
RemoveFromCache(this);
|
||||||
_CountFinalized++;
|
if (!_CacheByPrimaryKey.ContainsKey(ContentID.ToString())) return;
|
||||||
}
|
List<ImageInfo> listImageInfo = _CacheByPrimaryKey[ContentID.ToString()]; // Get the list of items
|
||||||
public void Dispose()
|
while (listImageInfo.Contains(this)) listImageInfo.Remove(this); // Remove the item from the list
|
||||||
{
|
if (listImageInfo.Count == 0) // If there are no items left in the list
|
||||||
if (_Disposed) return;
|
_CacheByPrimaryKey.Remove(ContentID.ToString()); // remove the list
|
||||||
_CountDisposed++;
|
}
|
||||||
_Disposed = true;
|
public virtual Image Get()
|
||||||
RemoveFromCache(this);
|
{
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(ContentID.ToString())) return;
|
return _Editable = Image.Get(_ContentID);
|
||||||
List<ImageInfo> listImageInfo = _CacheByPrimaryKey[ContentID.ToString()]; // Get the list of items
|
}
|
||||||
while (listImageInfo.Contains(this)) listImageInfo.Remove(this); // Remove the item from the list
|
public static void Refresh(Image tmp)
|
||||||
if (listImageInfo.Count == 0) // If there are no items left in the list
|
{
|
||||||
_CacheByPrimaryKey.Remove(ContentID.ToString()); // remove the list
|
string key = tmp.ContentID.ToString();
|
||||||
}
|
ConvertListToDictionary();
|
||||||
public virtual Image Get()
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
{
|
foreach (ImageInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
return _Editable = Image.Get(_ContentID);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
public static void Refresh(Image tmp)
|
protected virtual void RefreshFields(Image tmp)
|
||||||
{
|
{
|
||||||
string key = tmp.ContentID.ToString();
|
_ImageType = tmp.ImageType;
|
||||||
ConvertListToDictionary();
|
_FileName = tmp.FileName;
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
_Data = tmp.Data;
|
||||||
foreach (ImageInfo tmpInfo in _CacheByPrimaryKey[key])
|
_Config = tmp.Config;
|
||||||
tmpInfo.RefreshFields(tmp);
|
_DTS = tmp.DTS;
|
||||||
}
|
_UserID = tmp.UserID;
|
||||||
protected virtual void RefreshFields(Image tmp)
|
_ImageInfoExtension.Refresh(this);
|
||||||
{
|
//RHM Removed 20090724 - Duplicates function of code above.
|
||||||
_ImageType = tmp.ImageType;
|
// - Dispose caused error when a new step was added.
|
||||||
_FileName = tmp.FileName;
|
// - Resequence of transitions did not work properly.
|
||||||
_Data = tmp.Data;
|
// if(_MyContent != null)
|
||||||
_Config = tmp.Config;
|
// {
|
||||||
_DTS = tmp.DTS;
|
// _MyContent.Dispose();// Dispose related value
|
||||||
_UserID = tmp.UserID;
|
// _MyContent = null;// Reset related value
|
||||||
_ImageInfoExtension.Refresh(this);
|
// }
|
||||||
//RHM Removed 20090724 - Duplicates function of code above.
|
OnChange();// raise an event
|
||||||
// - Dispose caused error when a new step was added.
|
}
|
||||||
// - Resequence of transitions did not work properly.
|
public static ImageInfo Get(int contentID)
|
||||||
// if(_MyContent != null)
|
{
|
||||||
// {
|
//if (!CanGetObject())
|
||||||
// _MyContent.Dispose();// Dispose related value
|
// throw new System.Security.SecurityException("User not authorized to view a Image");
|
||||||
// _MyContent = null;// Reset related value
|
try
|
||||||
// }
|
{
|
||||||
OnChange();// raise an event
|
ImageInfo tmp = GetCachedByPrimaryKey(contentID);
|
||||||
}
|
if (tmp == null)
|
||||||
public static ImageInfo Get(int contentID)
|
{
|
||||||
{
|
tmp = DataPortal.Fetch<ImageInfo>(new PKCriteria(contentID));
|
||||||
//if (!CanGetObject())
|
AddToCache(tmp);
|
||||||
// throw new System.Security.SecurityException("User not authorized to view a Image");
|
}
|
||||||
try
|
if (tmp.ErrorMessage == "No Record Found")
|
||||||
{
|
{
|
||||||
ImageInfo tmp = GetCachedByPrimaryKey(contentID);
|
tmp.Dispose(); // Clean-up ImageInfo
|
||||||
if (tmp == null)
|
tmp = null;
|
||||||
{
|
}
|
||||||
tmp = DataPortal.Fetch<ImageInfo>(new PKCriteria(contentID));
|
return tmp;
|
||||||
AddToCache(tmp);
|
}
|
||||||
}
|
catch (Exception ex)
|
||||||
if (tmp.ErrorMessage == "No Record Found")
|
{
|
||||||
{
|
throw new DbCslaException("Error on ImageInfo.Get", ex);
|
||||||
tmp.Dispose(); // Clean-up ImageInfo
|
}
|
||||||
tmp = null;
|
}
|
||||||
}
|
#endregion
|
||||||
return tmp;
|
#region Data Access Portal
|
||||||
}
|
internal ImageInfo(SafeDataReader dr)
|
||||||
catch (Exception ex)
|
{
|
||||||
{
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ImageInfo.Constructor", GetHashCode());
|
||||||
throw new DbCslaException("Error on ImageInfo.Get", ex);
|
try
|
||||||
}
|
{
|
||||||
}
|
ReadData(dr);
|
||||||
#endregion
|
}
|
||||||
#region Data Access Portal
|
catch (Exception ex)
|
||||||
internal ImageInfo(SafeDataReader dr)
|
{
|
||||||
{
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("ImageInfo.Constructor", ex);
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ImageInfo.Constructor", GetHashCode());
|
throw new DbCslaException("ImageInfo.Constructor", ex);
|
||||||
try
|
}
|
||||||
{
|
}
|
||||||
ReadData(dr);
|
[Serializable()]
|
||||||
}
|
protected class PKCriteria
|
||||||
catch (Exception ex)
|
{
|
||||||
{
|
private int _ContentID;
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ImageInfo.Constructor", ex);
|
public int ContentID
|
||||||
throw new DbCslaException("ImageInfo.Constructor", ex);
|
{ get { return _ContentID; } }
|
||||||
}
|
public PKCriteria(int contentID)
|
||||||
}
|
{
|
||||||
[Serializable()]
|
_ContentID = contentID;
|
||||||
protected class PKCriteria
|
}
|
||||||
{
|
}
|
||||||
private int _ContentID;
|
private void ReadData(SafeDataReader dr)
|
||||||
public int ContentID
|
{
|
||||||
{ get { return _ContentID; } }
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ImageInfo.ReadData", GetHashCode());
|
||||||
public PKCriteria(int contentID)
|
try
|
||||||
{
|
{
|
||||||
_ContentID = contentID;
|
_ContentID = dr.GetInt32("ContentID");
|
||||||
}
|
_ImageType = dr.GetInt32("ImageType");
|
||||||
}
|
_FileName = dr.GetString("FileName");
|
||||||
private void ReadData(SafeDataReader dr)
|
_Data = (byte[])dr.GetValue("Data");
|
||||||
{
|
_Config = dr.GetString("Config");
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ImageInfo.ReadData", GetHashCode());
|
_DTS = dr.GetDateTime("DTS");
|
||||||
try
|
_UserID = dr.GetString("UserID");
|
||||||
{
|
}
|
||||||
_ContentID = dr.GetInt32("ContentID");
|
catch (Exception ex)
|
||||||
_ImageType = dr.GetInt32("ImageType");
|
{
|
||||||
_FileName = dr.GetString("FileName");
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("ImageInfo.ReadData", ex);
|
||||||
_Data = (byte[])dr.GetValue("Data");
|
_ErrorMessage = ex.Message;
|
||||||
_Config = dr.GetString("Config");
|
throw new DbCslaException("ImageInfo.ReadData", ex);
|
||||||
_DTS = dr.GetDateTime("DTS");
|
}
|
||||||
_UserID = dr.GetString("UserID");
|
}
|
||||||
}
|
private void DataPortal_Fetch(PKCriteria criteria)
|
||||||
catch (Exception ex)
|
{
|
||||||
{
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ImageInfo.DataPortal_Fetch", GetHashCode());
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ImageInfo.ReadData", ex);
|
try
|
||||||
_ErrorMessage = ex.Message;
|
{
|
||||||
throw new DbCslaException("ImageInfo.ReadData", ex);
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
}
|
{
|
||||||
}
|
ApplicationContext.LocalContext["cn"] = cn;
|
||||||
private void DataPortal_Fetch(PKCriteria criteria)
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
{
|
{
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ImageInfo.DataPortal_Fetch", GetHashCode());
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
try
|
cm.CommandText = "getImage";
|
||||||
{
|
cm.Parameters.AddWithValue("@ContentID", criteria.ContentID);
|
||||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
{
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
ApplicationContext.LocalContext["cn"] = cn;
|
{
|
||||||
using (SqlCommand cm = cn.CreateCommand())
|
if (!dr.Read())
|
||||||
{
|
{
|
||||||
cm.CommandType = CommandType.StoredProcedure;
|
_ErrorMessage = "No Record Found";
|
||||||
cm.CommandText = "getImage";
|
return;
|
||||||
cm.Parameters.AddWithValue("@ContentID", criteria.ContentID);
|
}
|
||||||
cm.CommandTimeout = Database.DefaultTimeout;
|
ReadData(dr);
|
||||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
}
|
||||||
{
|
}
|
||||||
if (!dr.Read())
|
// removing of item only needed for local data portal
|
||||||
{
|
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
||||||
_ErrorMessage = "No Record Found";
|
ApplicationContext.LocalContext.Remove("cn");
|
||||||
return;
|
}
|
||||||
}
|
}
|
||||||
ReadData(dr);
|
catch (Exception ex)
|
||||||
}
|
{
|
||||||
}
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("ImageInfo.DataPortal_Fetch", ex);
|
||||||
// removing of item only needed for local data portal
|
_ErrorMessage = ex.Message;
|
||||||
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
throw new DbCslaException("ImageInfo.DataPortal_Fetch", ex);
|
||||||
ApplicationContext.LocalContext.Remove("cn");
|
}
|
||||||
}
|
}
|
||||||
}
|
#endregion
|
||||||
catch (Exception ex)
|
// Standard Refresh
|
||||||
{
|
#region extension
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ImageInfo.DataPortal_Fetch", ex);
|
ImageInfoExtension _ImageInfoExtension = new ImageInfoExtension();
|
||||||
_ErrorMessage = ex.Message;
|
[Serializable()]
|
||||||
throw new DbCslaException("ImageInfo.DataPortal_Fetch", ex);
|
partial class ImageInfoExtension : extensionBase { }
|
||||||
}
|
[Serializable()]
|
||||||
}
|
class extensionBase
|
||||||
#endregion
|
{
|
||||||
// Standard Refresh
|
// Default Refresh
|
||||||
#region extension
|
public virtual void Refresh(ImageInfo tmp) { }
|
||||||
ImageInfoExtension _ImageInfoExtension = new ImageInfoExtension();
|
}
|
||||||
[Serializable()]
|
#endregion
|
||||||
partial class ImageInfoExtension : extensionBase { }
|
} // Class
|
||||||
[Serializable()]
|
#region Converter
|
||||||
class extensionBase
|
internal class ImageInfoConverter : ExpandableObjectConverter
|
||||||
{
|
{
|
||||||
// Default Refresh
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
public virtual void Refresh(ImageInfo tmp) { }
|
{
|
||||||
}
|
if (destType == typeof(string) && value is ImageInfo)
|
||||||
#endregion
|
{
|
||||||
} // Class
|
// Return the ToString value
|
||||||
#region Converter
|
return ((ImageInfo)value).ToString();
|
||||||
internal class ImageInfoConverter : ExpandableObjectConverter
|
}
|
||||||
{
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
}
|
||||||
{
|
}
|
||||||
if (destType == typeof(string) && value is ImageInfo)
|
#endregion
|
||||||
{
|
|
||||||
// Return the ToString value
|
|
||||||
return ((ImageInfo)value).ToString();
|
|
||||||
}
|
|
||||||
return base.ConvertTo(context, culture, value, destType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -19,361 +19,354 @@ using System.ComponentModel;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
public delegate void ItemAuditInfoEvent(object sender);
|
public delegate void ItemAuditInfoEvent(object sender);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ItemAuditInfo Generated by MyGeneration using the CSLA Object Mapping template
|
/// ItemAuditInfo Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
[TypeConverter(typeof(ItemAuditInfoConverter))]
|
[TypeConverter(typeof(ItemAuditInfoConverter))]
|
||||||
public partial class ItemAuditInfo : ReadOnlyBase<ItemAuditInfo>, IDisposable
|
public partial class ItemAuditInfo : ReadOnlyBase<ItemAuditInfo>, IDisposable
|
||||||
{
|
{
|
||||||
public event ItemAuditInfoEvent Changed;
|
public event ItemAuditInfoEvent Changed;
|
||||||
private void OnChange()
|
private void OnChange()
|
||||||
{
|
{
|
||||||
if (Changed != null) Changed(this);
|
if (Changed != null) Changed(this);
|
||||||
}
|
}
|
||||||
#region Log4Net
|
#region Log4Net
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
private static List<ItemAuditInfo> _CacheList = new List<ItemAuditInfo>();
|
private static List<ItemAuditInfo> _CacheList = new List<ItemAuditInfo>();
|
||||||
protected static void AddToCache(ItemAuditInfo itemAuditInfo)
|
protected static void AddToCache(ItemAuditInfo itemAuditInfo)
|
||||||
{
|
{
|
||||||
if (!_CacheList.Contains(itemAuditInfo)) _CacheList.Add(itemAuditInfo); // In AddToCache
|
if (!_CacheList.Contains(itemAuditInfo)) _CacheList.Add(itemAuditInfo); // In AddToCache
|
||||||
}
|
}
|
||||||
protected static void RemoveFromCache(ItemAuditInfo itemAuditInfo)
|
protected static void RemoveFromCache(ItemAuditInfo itemAuditInfo)
|
||||||
{
|
{
|
||||||
while (_CacheList.Contains(itemAuditInfo)) _CacheList.Remove(itemAuditInfo); // In RemoveFromCache
|
while (_CacheList.Contains(itemAuditInfo)) _CacheList.Remove(itemAuditInfo); // In RemoveFromCache
|
||||||
}
|
}
|
||||||
private static Dictionary<string, List<ItemAuditInfo>> _CacheByPrimaryKey = new Dictionary<string, List<ItemAuditInfo>>();
|
private static Dictionary<string, List<ItemAuditInfo>> _CacheByPrimaryKey = new Dictionary<string, List<ItemAuditInfo>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
while (_CacheList.Count > 0) // Move ItemAuditInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
while (_CacheList.Count > 0) // Move ItemAuditInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
||||||
{
|
{
|
||||||
ItemAuditInfo tmp = _CacheList[0]; // Get the first ItemAuditInfo
|
ItemAuditInfo tmp = _CacheList[0]; // Get the first ItemAuditInfo
|
||||||
string pKey = tmp.AuditID.ToString();
|
string pKey = tmp.AuditID.ToString();
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
||||||
{
|
{
|
||||||
_CacheByPrimaryKey[pKey] = new List<ItemAuditInfo>(); // Add new list for PrimaryKey
|
_CacheByPrimaryKey[pKey] = new List<ItemAuditInfo>(); // Add new list for PrimaryKey
|
||||||
}
|
}
|
||||||
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
||||||
_CacheList.RemoveAt(0); // Remove the first ItemAuditInfo
|
_CacheList.RemoveAt(0); // Remove the first ItemAuditInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
internal static void AddList(ItemAuditInfoList lst)
|
internal static void AddList(ItemAuditInfoList lst)
|
||||||
{
|
{
|
||||||
foreach (ItemAuditInfo item in lst) AddToCache(item);
|
foreach (ItemAuditInfo item in lst) AddToCache(item);
|
||||||
}
|
}
|
||||||
protected static ItemAuditInfo GetCachedByPrimaryKey(long auditID)
|
protected static ItemAuditInfo GetCachedByPrimaryKey(long auditID)
|
||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = auditID.ToString();
|
string key = auditID.ToString();
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Business Methods
|
#region Business Methods
|
||||||
private string _ErrorMessage = string.Empty;
|
private string _ErrorMessage = string.Empty;
|
||||||
public string ErrorMessage
|
public string ErrorMessage
|
||||||
{
|
{
|
||||||
get { return _ErrorMessage; }
|
get { return _ErrorMessage; }
|
||||||
}
|
}
|
||||||
protected ItemAudit _Editable;
|
protected ItemAudit _Editable;
|
||||||
private IVEHasBrokenRules HasBrokenRules
|
private IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
IVEHasBrokenRules hasBrokenRules = null;
|
IVEHasBrokenRules hasBrokenRules = null;
|
||||||
if (_Editable != null)
|
if (_Editable != null)
|
||||||
hasBrokenRules = _Editable.HasBrokenRules;
|
hasBrokenRules = _Editable.HasBrokenRules;
|
||||||
return hasBrokenRules;
|
return hasBrokenRules;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private long _AuditID;
|
private long _AuditID;
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
public long AuditID
|
public long AuditID
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("AuditID", true);
|
return _AuditID;
|
||||||
return _AuditID;
|
}
|
||||||
}
|
}
|
||||||
}
|
private int _ItemID;
|
||||||
private int _ItemID;
|
public int ItemID
|
||||||
public int ItemID
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
get
|
||||||
get
|
{
|
||||||
{
|
return _ItemID;
|
||||||
CanReadProperty("ItemID", true);
|
}
|
||||||
return _ItemID;
|
}
|
||||||
}
|
private int? _PreviousID;
|
||||||
}
|
public int? PreviousID
|
||||||
private int? _PreviousID;
|
{
|
||||||
public int? PreviousID
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
return _PreviousID;
|
||||||
{
|
}
|
||||||
CanReadProperty("PreviousID", true);
|
}
|
||||||
return _PreviousID;
|
private int _ContentID;
|
||||||
}
|
public int ContentID
|
||||||
}
|
{
|
||||||
private int _ContentID;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
public int ContentID
|
get
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
return _ContentID;
|
||||||
get
|
}
|
||||||
{
|
}
|
||||||
CanReadProperty("ContentID", true);
|
private DateTime _DTS = new DateTime();
|
||||||
return _ContentID;
|
public DateTime DTS
|
||||||
}
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
private DateTime _DTS = new DateTime();
|
get
|
||||||
public DateTime DTS
|
{
|
||||||
{
|
return _DTS;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
}
|
||||||
{
|
private string _UserID = string.Empty;
|
||||||
CanReadProperty("DTS", true);
|
public string UserID
|
||||||
return _DTS;
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
private string _UserID = string.Empty;
|
{
|
||||||
public string UserID
|
return _UserID;
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
private int _DeleteStatus;
|
||||||
{
|
public int DeleteStatus
|
||||||
CanReadProperty("UserID", true);
|
{
|
||||||
return _UserID;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
}
|
{
|
||||||
private int _DeleteStatus;
|
return _DeleteStatus;
|
||||||
public int DeleteStatus
|
}
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
// CSLATODO: Replace base ItemAuditInfo.ToString function as necessary
|
||||||
get
|
/// <summary>
|
||||||
{
|
/// Overrides Base ToString
|
||||||
CanReadProperty("DeleteStatus", true);
|
/// </summary>
|
||||||
return _DeleteStatus;
|
/// <returns>A string representation of current ItemAuditInfo</returns>
|
||||||
}
|
//public override string ToString()
|
||||||
}
|
//{
|
||||||
// CSLATODO: Replace base ItemAuditInfo.ToString function as necessary
|
// return base.ToString();
|
||||||
/// <summary>
|
//}
|
||||||
/// Overrides Base ToString
|
// CSLATODO: Check ItemAuditInfo.GetIdValue to assure that the ID returned is unique
|
||||||
/// </summary>
|
/// <summary>
|
||||||
/// <returns>A string representation of current ItemAuditInfo</returns>
|
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||||
//public override string ToString()
|
/// </summary>
|
||||||
//{
|
/// <returns>A Unique ID for the current ItemAuditInfo</returns>
|
||||||
// return base.ToString();
|
protected override object GetIdValue()
|
||||||
//}
|
{
|
||||||
// CSLATODO: Check ItemAuditInfo.GetIdValue to assure that the ID returned is unique
|
return MyItemAuditInfoUnique; // Absolutely Unique ID
|
||||||
/// <summary>
|
}
|
||||||
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
#endregion
|
||||||
/// </summary>
|
#region Factory Methods
|
||||||
/// <returns>A Unique ID for the current ItemAuditInfo</returns>
|
private static int _ItemAuditInfoUnique = 0;
|
||||||
protected override object GetIdValue()
|
private static int ItemAuditInfoUnique
|
||||||
{
|
{ get { return ++_ItemAuditInfoUnique; } }
|
||||||
return MyItemAuditInfoUnique; // Absolutely Unique ID
|
private int _MyItemAuditInfoUnique = ItemAuditInfoUnique;
|
||||||
}
|
public int MyItemAuditInfoUnique // Absolutely Unique ID - Info
|
||||||
#endregion
|
{ get { return _MyItemAuditInfoUnique; } }
|
||||||
#region Factory Methods
|
protected ItemAuditInfo()
|
||||||
private static int _ItemAuditInfoUnique = 0;
|
{/* require use of factory methods */
|
||||||
private static int ItemAuditInfoUnique
|
AddToCache(this);
|
||||||
{ get { return ++_ItemAuditInfoUnique; } }
|
}
|
||||||
private int _MyItemAuditInfoUnique = ItemAuditInfoUnique;
|
private bool _Disposed = false;
|
||||||
public int MyItemAuditInfoUnique // Absolutely Unique ID - Info
|
private static int _CountCreated = 0;
|
||||||
{ get { return _MyItemAuditInfoUnique; } }
|
private static int _CountDisposed = 0;
|
||||||
protected ItemAuditInfo()
|
private static int _CountFinalized = 0;
|
||||||
{/* require use of factory methods */
|
private static int IncrementCountCreated
|
||||||
AddToCache(this);
|
{ get { return ++_CountCreated; } }
|
||||||
}
|
private int _CountWhenCreated = IncrementCountCreated;
|
||||||
private bool _Disposed = false;
|
public static int CountCreated
|
||||||
private static int _CountCreated = 0;
|
{ get { return _CountCreated; } }
|
||||||
private static int _CountDisposed = 0;
|
public static int CountNotDisposed
|
||||||
private static int _CountFinalized = 0;
|
{ get { return _CountCreated - _CountDisposed; } }
|
||||||
private static int IncrementCountCreated
|
public static int CountNotFinalized
|
||||||
{ get { return ++_CountCreated; } }
|
{ get { return _CountCreated - _CountFinalized; } }
|
||||||
private int _CountWhenCreated = IncrementCountCreated;
|
~ItemAuditInfo()
|
||||||
public static int CountCreated
|
{
|
||||||
{ get { return _CountCreated; } }
|
_CountFinalized++;
|
||||||
public static int CountNotDisposed
|
}
|
||||||
{ get { return _CountCreated - _CountDisposed; } }
|
public void Dispose()
|
||||||
public static int CountNotFinalized
|
{
|
||||||
{ get { return _CountCreated - _CountFinalized; } }
|
if (_Disposed) return;
|
||||||
~ItemAuditInfo()
|
_CountDisposed++;
|
||||||
{
|
_Disposed = true;
|
||||||
_CountFinalized++;
|
RemoveFromCache(this);
|
||||||
}
|
if (!_CacheByPrimaryKey.ContainsKey(AuditID.ToString())) return;
|
||||||
public void Dispose()
|
List<ItemAuditInfo> listItemAuditInfo = _CacheByPrimaryKey[AuditID.ToString()]; // Get the list of items
|
||||||
{
|
while (listItemAuditInfo.Contains(this)) listItemAuditInfo.Remove(this); // Remove the item from the list
|
||||||
if (_Disposed) return;
|
if (listItemAuditInfo.Count == 0) // If there are no items left in the list
|
||||||
_CountDisposed++;
|
_CacheByPrimaryKey.Remove(AuditID.ToString()); // remove the list
|
||||||
_Disposed = true;
|
}
|
||||||
RemoveFromCache(this);
|
public virtual ItemAudit Get()
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(AuditID.ToString())) return;
|
{
|
||||||
List<ItemAuditInfo> listItemAuditInfo = _CacheByPrimaryKey[AuditID.ToString()]; // Get the list of items
|
return _Editable = ItemAudit.Get(_AuditID);
|
||||||
while (listItemAuditInfo.Contains(this)) listItemAuditInfo.Remove(this); // Remove the item from the list
|
}
|
||||||
if (listItemAuditInfo.Count == 0) // If there are no items left in the list
|
public static void Refresh(ItemAudit tmp)
|
||||||
_CacheByPrimaryKey.Remove(AuditID.ToString()); // remove the list
|
{
|
||||||
}
|
string key = tmp.AuditID.ToString();
|
||||||
public virtual ItemAudit Get()
|
ConvertListToDictionary();
|
||||||
{
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
return _Editable = ItemAudit.Get(_AuditID);
|
foreach (ItemAuditInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
}
|
tmpInfo.RefreshFields(tmp);
|
||||||
public static void Refresh(ItemAudit tmp)
|
}
|
||||||
{
|
protected virtual void RefreshFields(ItemAudit tmp)
|
||||||
string key = tmp.AuditID.ToString();
|
{
|
||||||
ConvertListToDictionary();
|
_ItemID = tmp.ItemID;
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
_PreviousID = tmp.PreviousID;
|
||||||
foreach (ItemAuditInfo tmpInfo in _CacheByPrimaryKey[key])
|
_ContentID = tmp.ContentID;
|
||||||
tmpInfo.RefreshFields(tmp);
|
_DTS = tmp.DTS;
|
||||||
}
|
_UserID = tmp.UserID;
|
||||||
protected virtual void RefreshFields(ItemAudit tmp)
|
_DeleteStatus = tmp.DeleteStatus;
|
||||||
{
|
_ItemAuditInfoExtension.Refresh(this);
|
||||||
_ItemID = tmp.ItemID;
|
OnChange();// raise an event
|
||||||
_PreviousID = tmp.PreviousID;
|
}
|
||||||
_ContentID = tmp.ContentID;
|
public static ItemAuditInfo Get(long auditID)
|
||||||
_DTS = tmp.DTS;
|
{
|
||||||
_UserID = tmp.UserID;
|
//if (!CanGetObject())
|
||||||
_DeleteStatus = tmp.DeleteStatus;
|
// throw new System.Security.SecurityException("User not authorized to view a ItemAudit");
|
||||||
_ItemAuditInfoExtension.Refresh(this);
|
try
|
||||||
OnChange();// raise an event
|
{
|
||||||
}
|
ItemAuditInfo tmp = GetCachedByPrimaryKey(auditID);
|
||||||
public static ItemAuditInfo Get(long auditID)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
//if (!CanGetObject())
|
tmp = DataPortal.Fetch<ItemAuditInfo>(new PKCriteria(auditID));
|
||||||
// throw new System.Security.SecurityException("User not authorized to view a ItemAudit");
|
AddToCache(tmp);
|
||||||
try
|
}
|
||||||
{
|
if (tmp.ErrorMessage == "No Record Found")
|
||||||
ItemAuditInfo tmp = GetCachedByPrimaryKey(auditID);
|
{
|
||||||
if (tmp == null)
|
tmp.Dispose(); // Clean-up ItemAuditInfo
|
||||||
{
|
tmp = null;
|
||||||
tmp = DataPortal.Fetch<ItemAuditInfo>(new PKCriteria(auditID));
|
}
|
||||||
AddToCache(tmp);
|
return tmp;
|
||||||
}
|
}
|
||||||
if (tmp.ErrorMessage == "No Record Found")
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
tmp.Dispose(); // Clean-up ItemAuditInfo
|
throw new DbCslaException("Error on ItemAuditInfo.Get", ex);
|
||||||
tmp = null;
|
}
|
||||||
}
|
}
|
||||||
return tmp;
|
#endregion
|
||||||
}
|
#region Data Access Portal
|
||||||
catch (Exception ex)
|
internal ItemAuditInfo(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
throw new DbCslaException("Error on ItemAuditInfo.Get", ex);
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemAuditInfo.Constructor", GetHashCode());
|
||||||
}
|
try
|
||||||
}
|
{
|
||||||
#endregion
|
ReadData(dr);
|
||||||
#region Data Access Portal
|
}
|
||||||
internal ItemAuditInfo(SafeDataReader dr)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemAuditInfo.Constructor", GetHashCode());
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemAuditInfo.Constructor", ex);
|
||||||
try
|
throw new DbCslaException("ItemAuditInfo.Constructor", ex);
|
||||||
{
|
}
|
||||||
ReadData(dr);
|
}
|
||||||
}
|
[Serializable()]
|
||||||
catch (Exception ex)
|
protected class PKCriteria
|
||||||
{
|
{
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemAuditInfo.Constructor", ex);
|
private long _AuditID;
|
||||||
throw new DbCslaException("ItemAuditInfo.Constructor", ex);
|
public long AuditID
|
||||||
}
|
{ get { return _AuditID; } }
|
||||||
}
|
public PKCriteria(long auditID)
|
||||||
[Serializable()]
|
{
|
||||||
protected class PKCriteria
|
_AuditID = auditID;
|
||||||
{
|
}
|
||||||
private long _AuditID;
|
}
|
||||||
public long AuditID
|
private void ReadData(SafeDataReader dr)
|
||||||
{ get { return _AuditID; } }
|
{
|
||||||
public PKCriteria(long auditID)
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemAuditInfo.ReadData", GetHashCode());
|
||||||
{
|
try
|
||||||
_AuditID = auditID;
|
{
|
||||||
}
|
_AuditID = dr.GetInt64("AuditID");
|
||||||
}
|
_ItemID = dr.GetInt32("ItemID");
|
||||||
private void ReadData(SafeDataReader dr)
|
_PreviousID = (int?)dr.GetValue("PreviousID");
|
||||||
{
|
_ContentID = dr.GetInt32("ContentID");
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemAuditInfo.ReadData", GetHashCode());
|
_DTS = dr.GetDateTime("DTS");
|
||||||
try
|
_UserID = dr.GetString("UserID");
|
||||||
{
|
_DeleteStatus = dr.GetInt32("DeleteStatus");
|
||||||
_AuditID = dr.GetInt64("AuditID");
|
}
|
||||||
_ItemID = dr.GetInt32("ItemID");
|
catch (Exception ex)
|
||||||
_PreviousID = (int?)dr.GetValue("PreviousID");
|
{
|
||||||
_ContentID = dr.GetInt32("ContentID");
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemAuditInfo.ReadData", ex);
|
||||||
_DTS = dr.GetDateTime("DTS");
|
_ErrorMessage = ex.Message;
|
||||||
_UserID = dr.GetString("UserID");
|
throw new DbCslaException("ItemAuditInfo.ReadData", ex);
|
||||||
_DeleteStatus = dr.GetInt32("DeleteStatus");
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
private void DataPortal_Fetch(PKCriteria criteria)
|
||||||
{
|
{
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemAuditInfo.ReadData", ex);
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemAuditInfo.DataPortal_Fetch", GetHashCode());
|
||||||
_ErrorMessage = ex.Message;
|
try
|
||||||
throw new DbCslaException("ItemAuditInfo.ReadData", ex);
|
{
|
||||||
}
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
}
|
{
|
||||||
private void DataPortal_Fetch(PKCriteria criteria)
|
ApplicationContext.LocalContext["cn"] = cn;
|
||||||
{
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemAuditInfo.DataPortal_Fetch", GetHashCode());
|
{
|
||||||
try
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
{
|
cm.CommandText = "getItemAudit";
|
||||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
cm.Parameters.AddWithValue("@AuditID", criteria.AuditID);
|
||||||
{
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
ApplicationContext.LocalContext["cn"] = cn;
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
using (SqlCommand cm = cn.CreateCommand())
|
{
|
||||||
{
|
if (!dr.Read())
|
||||||
cm.CommandType = CommandType.StoredProcedure;
|
{
|
||||||
cm.CommandText = "getItemAudit";
|
_ErrorMessage = "No Record Found";
|
||||||
cm.Parameters.AddWithValue("@AuditID", criteria.AuditID);
|
return;
|
||||||
cm.CommandTimeout = Database.DefaultTimeout;
|
}
|
||||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
ReadData(dr);
|
||||||
{
|
}
|
||||||
if (!dr.Read())
|
}
|
||||||
{
|
// removing of item only needed for local data portal
|
||||||
_ErrorMessage = "No Record Found";
|
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
||||||
return;
|
ApplicationContext.LocalContext.Remove("cn");
|
||||||
}
|
}
|
||||||
ReadData(dr);
|
}
|
||||||
}
|
catch (Exception ex)
|
||||||
}
|
{
|
||||||
// removing of item only needed for local data portal
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemAuditInfo.DataPortal_Fetch", ex);
|
||||||
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
_ErrorMessage = ex.Message;
|
||||||
ApplicationContext.LocalContext.Remove("cn");
|
throw new DbCslaException("ItemAuditInfo.DataPortal_Fetch", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
#endregion
|
||||||
{
|
// Standard Refresh
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemAuditInfo.DataPortal_Fetch", ex);
|
#region extension
|
||||||
_ErrorMessage = ex.Message;
|
ItemAuditInfoExtension _ItemAuditInfoExtension = new ItemAuditInfoExtension();
|
||||||
throw new DbCslaException("ItemAuditInfo.DataPortal_Fetch", ex);
|
[Serializable()]
|
||||||
}
|
partial class ItemAuditInfoExtension : extensionBase { }
|
||||||
}
|
[Serializable()]
|
||||||
#endregion
|
class extensionBase
|
||||||
// Standard Refresh
|
{
|
||||||
#region extension
|
// Default Refresh
|
||||||
ItemAuditInfoExtension _ItemAuditInfoExtension = new ItemAuditInfoExtension();
|
public virtual void Refresh(ItemAuditInfo tmp) { }
|
||||||
[Serializable()]
|
}
|
||||||
partial class ItemAuditInfoExtension : extensionBase { }
|
#endregion
|
||||||
[Serializable()]
|
} // Class
|
||||||
class extensionBase
|
#region Converter
|
||||||
{
|
internal class ItemAuditInfoConverter : ExpandableObjectConverter
|
||||||
// Default Refresh
|
{
|
||||||
public virtual void Refresh(ItemAuditInfo tmp) { }
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
}
|
{
|
||||||
#endregion
|
if (destType == typeof(string) && value is ItemAuditInfo)
|
||||||
} // Class
|
{
|
||||||
#region Converter
|
// Return the ToString value
|
||||||
internal class ItemAuditInfoConverter : ExpandableObjectConverter
|
return ((ItemAuditInfo)value).ToString();
|
||||||
{
|
}
|
||||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
{
|
}
|
||||||
if (destType == typeof(string) && value is ItemAuditInfo)
|
}
|
||||||
{
|
#endregion
|
||||||
// Return the ToString value
|
|
||||||
return ((ItemAuditInfo)value).ToString();
|
|
||||||
}
|
|
||||||
return base.ConvertTo(context, culture, value, destType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -19,373 +19,373 @@ using System.ComponentModel;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ItemInfoList Generated by MyGeneration using the CSLA Object Mapping template
|
/// ItemInfoList Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
[TypeConverter(typeof(ItemInfoListConverter))]
|
[TypeConverter(typeof(ItemInfoListConverter))]
|
||||||
public partial class ItemInfoList : ReadOnlyListBase<ItemInfoList, ItemInfo>, ICustomTypeDescriptor, IDisposable
|
public partial class ItemInfoList : ReadOnlyListBase<ItemInfoList, ItemInfo>, ICustomTypeDescriptor, IDisposable
|
||||||
{
|
{
|
||||||
#region Log4Net
|
#region Log4Net
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#endregion
|
#endregion
|
||||||
#region Business Methods
|
#region Business Methods
|
||||||
internal new IList<ItemInfo> Items
|
internal new IList<ItemInfo> Items
|
||||||
{ get { return base.Items; } }
|
{ get { return base.Items; } }
|
||||||
public void AddEvents()
|
public void AddEvents()
|
||||||
{
|
{
|
||||||
foreach (ItemInfo tmp in this)
|
foreach (ItemInfo tmp in this)
|
||||||
{
|
{
|
||||||
tmp.Changed += new ItemInfoEvent(tmp_Changed);
|
tmp.Changed += new ItemInfoEvent(tmp_Changed);
|
||||||
tmp.Deleted += new ItemInfoEvent(tmp_Deleted);
|
tmp.Deleted += new ItemInfoEvent(tmp_Deleted);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private bool _RefreshingList = false;
|
private bool _RefreshingList = false;
|
||||||
public bool RefreshingList
|
public bool RefreshingList
|
||||||
{
|
{
|
||||||
get { return _RefreshingList; }
|
get { return _RefreshingList; }
|
||||||
set { _RefreshingList = value; }
|
set { _RefreshingList = value; }
|
||||||
}
|
}
|
||||||
void tmp_Deleted(object sender)
|
void tmp_Deleted(object sender)
|
||||||
{
|
{
|
||||||
ItemInfo ii = sender as ItemInfo;
|
ItemInfo ii = sender as ItemInfo;
|
||||||
if (ii != null)
|
if (ii != null)
|
||||||
{
|
{
|
||||||
RefreshingList = true;
|
RefreshingList = true;
|
||||||
IsReadOnly = false;
|
IsReadOnly = false;
|
||||||
Remove(ii);
|
Remove(ii);
|
||||||
IsReadOnly = true;
|
IsReadOnly = true;
|
||||||
this.OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, 0));
|
this.OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, 0));
|
||||||
RefreshingList = false;
|
RefreshingList = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// sender can be either the current item changed, or the current item with one added before it (when an item is inserted)
|
// sender can be either the current item changed, or the current item with one added before it (when an item is inserted)
|
||||||
void tmp_Changed(object sender)
|
void tmp_Changed(object sender)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < Count; i++)
|
for (int i = 0; i < Count; i++)
|
||||||
{
|
{
|
||||||
if (base[i] == sender)
|
if (base[i] == sender)
|
||||||
{
|
{
|
||||||
// Added insert to fix when item is replaced and a 'delete' is done, the item needs inserted. Note
|
// Added insert to fix when item is replaced and a 'delete' is done, the item needs inserted. Note
|
||||||
// that when text is modified, i.e. 'Changed', this code is not executed. Fixed B2016-130.
|
// that when text is modified, i.e. 'Changed', this code is not executed. Fixed B2016-130.
|
||||||
RefreshingList = true;
|
RefreshingList = true;
|
||||||
IsReadOnly = false;
|
IsReadOnly = false;
|
||||||
// the following checks to see if the previous is this one, and if so, it is not an insert it is a change
|
// the following checks to see if the previous is this one, and if so, it is not an insert it is a change
|
||||||
// On an insert, inserting from 'sender', MyPrevious is set as the new item.
|
// On an insert, inserting from 'sender', MyPrevious is set as the new item.
|
||||||
if (SourceOfList != "Search" && (sender as ItemInfo).MyPrevious != null && i > 0 && base[i - 1].ItemID != (sender as ItemInfo).MyPrevious.ItemID)
|
if (SourceOfList != "Search" && (sender as ItemInfo).MyPrevious != null && i > 0 && base[i - 1].ItemID != (sender as ItemInfo).MyPrevious.ItemID)
|
||||||
Items.Insert(i, (sender as ItemInfo).MyPrevious);
|
Items.Insert(i, (sender as ItemInfo).MyPrevious);
|
||||||
IsReadOnly = true;
|
IsReadOnly = true;
|
||||||
this.OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, i));
|
this.OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, i));
|
||||||
RefreshingList = false;
|
RefreshingList = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private string _SourceOfList;
|
private string _SourceOfList;
|
||||||
public string SourceOfList
|
public string SourceOfList
|
||||||
{
|
{
|
||||||
get { return _SourceOfList; }
|
get { return _SourceOfList; }
|
||||||
set { _SourceOfList = value; }
|
set { _SourceOfList = value; }
|
||||||
}
|
}
|
||||||
//private void ShowList(string txt)
|
//private void ShowList(string txt)
|
||||||
//{
|
//{
|
||||||
// Console.WriteLine("\r\n{0} - {1} - {2}: i, base[i].Ordinal, base[i].ItemID, base[i].DisplayText", txt, Count, SourceOfList);
|
// Console.WriteLine("\r\n{0} - {1} - {2}: i, base[i].Ordinal, base[i].ItemID, base[i].DisplayText", txt, Count, SourceOfList);
|
||||||
// for (int i = 0; i < Count; i++)
|
// for (int i = 0; i < Count; i++)
|
||||||
// {
|
// {
|
||||||
// Console.WriteLine("{0}, {1}, {2}, {3}, {4}, {5}", i, base[i].Ordinal, base[i].ItemID, base[i].DisplayText, base[i].MyItemInfoUnique, base[i].Disposed);
|
// Console.WriteLine("{0}, {1}, {2}, {3}, {4}, {5}", i, base[i].Ordinal, base[i].ItemID, base[i].DisplayText, base[i].MyItemInfoUnique, base[i].Disposed);
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
private bool _Disposed = false;
|
private bool _Disposed = false;
|
||||||
private static int _CountCreated = 0;
|
private static int _CountCreated = 0;
|
||||||
private static int _CountDisposed = 0;
|
private static int _CountDisposed = 0;
|
||||||
private static int _CountFinalized = 0;
|
private static int _CountFinalized = 0;
|
||||||
private static int IncrementCountCreated
|
private static int IncrementCountCreated
|
||||||
{ get { return ++_CountCreated; } }
|
{ get { return ++_CountCreated; } }
|
||||||
private int _CountWhenCreated = IncrementCountCreated;
|
private int _CountWhenCreated = IncrementCountCreated;
|
||||||
public static int CountCreated
|
public static int CountCreated
|
||||||
{ get { return _CountCreated; } }
|
{ get { return _CountCreated; } }
|
||||||
public static int CountNotDisposed
|
public static int CountNotDisposed
|
||||||
{ get { return _CountCreated - _CountDisposed; } }
|
{ get { return _CountCreated - _CountDisposed; } }
|
||||||
public static int CountNotFinalized
|
public static int CountNotFinalized
|
||||||
{ get { return _CountCreated - _CountFinalized; } }
|
{ get { return _CountCreated - _CountFinalized; } }
|
||||||
~ItemInfoList()
|
~ItemInfoList()
|
||||||
{
|
{
|
||||||
_CountFinalized++;
|
_CountFinalized++;
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
if (_Disposed) return;
|
if (_Disposed) return;
|
||||||
_Disposed = true;
|
_Disposed = true;
|
||||||
_CountDisposed++;
|
_CountDisposed++;
|
||||||
foreach (ItemInfo tmp in this)
|
foreach (ItemInfo tmp in this)
|
||||||
{
|
{
|
||||||
tmp.Changed -= new ItemInfoEvent(tmp_Changed);
|
tmp.Changed -= tmp_Changed;
|
||||||
tmp.Deleted -= new ItemInfoEvent(tmp_Deleted);
|
tmp.Deleted -= tmp_Deleted;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
public static ItemInfoList _ItemInfoList = null;
|
public static ItemInfoList _ItemInfoList = null;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return a list of all ItemInfo.
|
/// Return a list of all ItemInfo.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static ItemInfoList Get()
|
public static ItemInfoList Get()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (_ItemInfoList != null)
|
if (_ItemInfoList != null)
|
||||||
return _ItemInfoList;
|
return _ItemInfoList;
|
||||||
ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>();
|
ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>();
|
||||||
ItemInfo.AddList(tmp);
|
ItemInfo.AddList(tmp);
|
||||||
tmp.AddEvents();
|
tmp.AddEvents();
|
||||||
_ItemInfoList = tmp;
|
_ItemInfoList = tmp;
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
throw new DbCslaException("Error on ItemInfoList.Get", ex);
|
throw new DbCslaException("Error on ItemInfoList.Get", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reset the list of all ItemInfo.
|
/// Reset the list of all ItemInfo.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void Reset()
|
public static void Reset()
|
||||||
{
|
{
|
||||||
_ItemInfoList = null;
|
_ItemInfoList = null;
|
||||||
}
|
}
|
||||||
// CSLATODO: Add alternative gets -
|
// CSLATODO: Add alternative gets -
|
||||||
//public static ItemInfoList Get(<criteria>)
|
//public static ItemInfoList Get(<criteria>)
|
||||||
//{
|
//{
|
||||||
// try
|
// try
|
||||||
// {
|
// {
|
||||||
// return DataPortal.Fetch<ItemInfoList>(new FilteredCriteria(<criteria>));
|
// return DataPortal.Fetch<ItemInfoList>(new FilteredCriteria(<criteria>));
|
||||||
// }
|
// }
|
||||||
// catch (Exception ex)
|
// catch (Exception ex)
|
||||||
// {
|
// {
|
||||||
// throw new DbCslaException("Error on ItemInfoList.Get", ex);
|
// throw new DbCslaException("Error on ItemInfoList.Get", ex);
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
public static ItemInfoList GetNext(int? previousID)
|
public static ItemInfoList GetNext(int? previousID)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new PreviousIDCriteria(previousID));
|
ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new PreviousIDCriteria(previousID));
|
||||||
ItemInfo.AddList(tmp);
|
ItemInfo.AddList(tmp);
|
||||||
tmp.AddEvents();
|
tmp.AddEvents();
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
throw new DbCslaException("Error on ItemInfoList.GetNext", ex);
|
throw new DbCslaException("Error on ItemInfoList.GetNext", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static ItemInfoList GetByContentID(int contentID)
|
public static ItemInfoList GetByContentID(int contentID)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ContentIDCriteria(contentID));
|
ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ContentIDCriteria(contentID));
|
||||||
ItemInfo.AddList(tmp);
|
ItemInfo.AddList(tmp);
|
||||||
tmp.AddEvents();
|
tmp.AddEvents();
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
throw new DbCslaException("Error on ItemInfoList.GetByContentID", ex);
|
throw new DbCslaException("Error on ItemInfoList.GetByContentID", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private ItemInfoList()
|
private ItemInfoList()
|
||||||
{ /* require use of factory methods */ }
|
{ /* require use of factory methods */ }
|
||||||
#endregion
|
#endregion
|
||||||
#region Data Access Portal
|
#region Data Access Portal
|
||||||
private void DataPortal_Fetch()
|
private void DataPortal_Fetch()
|
||||||
{
|
{
|
||||||
this.RaiseListChangedEvents = false;
|
this.RaiseListChangedEvents = false;
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemInfoList.DataPortal_Fetch", GetHashCode());
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemInfoList.DataPortal_Fetch", GetHashCode());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
{
|
{
|
||||||
using (SqlCommand cm = cn.CreateCommand())
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
{
|
{
|
||||||
cm.CommandType = CommandType.StoredProcedure;
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
cm.CommandText = "getItems";
|
cm.CommandText = "getItems";
|
||||||
cm.CommandTimeout = Database.DefaultTimeout;
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
{
|
{
|
||||||
IsReadOnly = false;
|
IsReadOnly = false;
|
||||||
while (dr.Read()) this.Add(new ItemInfo(dr));
|
while (dr.Read()) this.Add(new ItemInfo(dr));
|
||||||
IsReadOnly = true;
|
IsReadOnly = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemInfoList.DataPortal_Fetch", ex);
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemInfoList.DataPortal_Fetch", ex);
|
||||||
throw new DbCslaException("ItemInfoList.DataPortal_Fetch", ex);
|
throw new DbCslaException("ItemInfoList.DataPortal_Fetch", ex);
|
||||||
}
|
}
|
||||||
this.RaiseListChangedEvents = true;
|
this.RaiseListChangedEvents = true;
|
||||||
}
|
}
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
private class PreviousIDCriteria
|
private class PreviousIDCriteria
|
||||||
{
|
{
|
||||||
public PreviousIDCriteria(int? previousID)
|
public PreviousIDCriteria(int? previousID)
|
||||||
{
|
{
|
||||||
_PreviousID = previousID;
|
_PreviousID = previousID;
|
||||||
}
|
}
|
||||||
private int? _PreviousID;
|
private int? _PreviousID;
|
||||||
public int? PreviousID
|
public int? PreviousID
|
||||||
{
|
{
|
||||||
get { return _PreviousID; }
|
get { return _PreviousID; }
|
||||||
set { _PreviousID = value; }
|
set { _PreviousID = value; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void DataPortal_Fetch(PreviousIDCriteria criteria)
|
private void DataPortal_Fetch(PreviousIDCriteria criteria)
|
||||||
{
|
{
|
||||||
this.RaiseListChangedEvents = false;
|
this.RaiseListChangedEvents = false;
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemInfoList.DataPortal_FetchPreviousID", GetHashCode());
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemInfoList.DataPortal_FetchPreviousID", GetHashCode());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
{
|
{
|
||||||
using (SqlCommand cm = cn.CreateCommand())
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
{
|
{
|
||||||
cm.CommandType = CommandType.StoredProcedure;
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
cm.CommandText = "getNextItems";
|
cm.CommandText = "getNextItems";
|
||||||
cm.Parameters.AddWithValue("@PreviousID", criteria.PreviousID);
|
cm.Parameters.AddWithValue("@PreviousID", criteria.PreviousID);
|
||||||
cm.CommandTimeout = Database.DefaultTimeout;
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
{
|
{
|
||||||
IsReadOnly = false;
|
IsReadOnly = false;
|
||||||
while (dr.Read()) this.Add(new ItemInfo(dr));
|
while (dr.Read()) this.Add(new ItemInfo(dr));
|
||||||
IsReadOnly = true;
|
IsReadOnly = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemInfoList.DataPortal_FetchPreviousID", ex);
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemInfoList.DataPortal_FetchPreviousID", ex);
|
||||||
throw new DbCslaException("ItemInfoList.DataPortal_Fetch", ex);
|
throw new DbCslaException("ItemInfoList.DataPortal_Fetch", ex);
|
||||||
}
|
}
|
||||||
this.RaiseListChangedEvents = true;
|
this.RaiseListChangedEvents = true;
|
||||||
}
|
}
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
private class ContentIDCriteria
|
private class ContentIDCriteria
|
||||||
{
|
{
|
||||||
public ContentIDCriteria(int contentID)
|
public ContentIDCriteria(int contentID)
|
||||||
{
|
{
|
||||||
_ContentID = contentID;
|
_ContentID = contentID;
|
||||||
}
|
}
|
||||||
private int _ContentID;
|
private int _ContentID;
|
||||||
public int ContentID
|
public int ContentID
|
||||||
{
|
{
|
||||||
get { return _ContentID; }
|
get { return _ContentID; }
|
||||||
set { _ContentID = value; }
|
set { _ContentID = value; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void DataPortal_Fetch(ContentIDCriteria criteria)
|
private void DataPortal_Fetch(ContentIDCriteria criteria)
|
||||||
{
|
{
|
||||||
this.RaiseListChangedEvents = false;
|
this.RaiseListChangedEvents = false;
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemInfoList.DataPortal_FetchContentID", GetHashCode());
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemInfoList.DataPortal_FetchContentID", GetHashCode());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
{
|
{
|
||||||
using (SqlCommand cm = cn.CreateCommand())
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
{
|
{
|
||||||
cm.CommandType = CommandType.StoredProcedure;
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
cm.CommandText = "getItemsByContentID";
|
cm.CommandText = "getItemsByContentID";
|
||||||
cm.Parameters.AddWithValue("@ContentID", criteria.ContentID);
|
cm.Parameters.AddWithValue("@ContentID", criteria.ContentID);
|
||||||
cm.CommandTimeout = Database.DefaultTimeout;
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
{
|
{
|
||||||
IsReadOnly = false;
|
IsReadOnly = false;
|
||||||
while (dr.Read()) this.Add(new ItemInfo(dr));
|
while (dr.Read()) this.Add(new ItemInfo(dr));
|
||||||
IsReadOnly = true;
|
IsReadOnly = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemInfoList.DataPortal_FetchContentID", ex);
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemInfoList.DataPortal_FetchContentID", ex);
|
||||||
throw new DbCslaException("ItemInfoList.DataPortal_Fetch", ex);
|
throw new DbCslaException("ItemInfoList.DataPortal_Fetch", ex);
|
||||||
}
|
}
|
||||||
this.RaiseListChangedEvents = true;
|
this.RaiseListChangedEvents = true;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region ICustomTypeDescriptor impl
|
#region ICustomTypeDescriptor impl
|
||||||
public String GetClassName()
|
public String GetClassName()
|
||||||
{ return TypeDescriptor.GetClassName(this, true); }
|
{ return TypeDescriptor.GetClassName(this, true); }
|
||||||
public AttributeCollection GetAttributes()
|
public AttributeCollection GetAttributes()
|
||||||
{ return TypeDescriptor.GetAttributes(this, true); }
|
{ return TypeDescriptor.GetAttributes(this, true); }
|
||||||
public String GetComponentName()
|
public String GetComponentName()
|
||||||
{ return TypeDescriptor.GetComponentName(this, true); }
|
{ return TypeDescriptor.GetComponentName(this, true); }
|
||||||
public TypeConverter GetConverter()
|
public TypeConverter GetConverter()
|
||||||
{ return TypeDescriptor.GetConverter(this, true); }
|
{ return TypeDescriptor.GetConverter(this, true); }
|
||||||
public EventDescriptor GetDefaultEvent()
|
public EventDescriptor GetDefaultEvent()
|
||||||
{ return TypeDescriptor.GetDefaultEvent(this, true); }
|
{ return TypeDescriptor.GetDefaultEvent(this, true); }
|
||||||
public PropertyDescriptor GetDefaultProperty()
|
public PropertyDescriptor GetDefaultProperty()
|
||||||
{ return TypeDescriptor.GetDefaultProperty(this, true); }
|
{ return TypeDescriptor.GetDefaultProperty(this, true); }
|
||||||
public object GetEditor(Type editorBaseType)
|
public object GetEditor(Type editorBaseType)
|
||||||
{ return TypeDescriptor.GetEditor(this, editorBaseType, true); }
|
{ return TypeDescriptor.GetEditor(this, editorBaseType, true); }
|
||||||
public EventDescriptorCollection GetEvents(Attribute[] attributes)
|
public EventDescriptorCollection GetEvents(Attribute[] attributes)
|
||||||
{ return TypeDescriptor.GetEvents(this, attributes, true); }
|
{ return TypeDescriptor.GetEvents(this, attributes, true); }
|
||||||
public EventDescriptorCollection GetEvents()
|
public EventDescriptorCollection GetEvents()
|
||||||
{ return TypeDescriptor.GetEvents(this, true); }
|
{ return TypeDescriptor.GetEvents(this, true); }
|
||||||
public object GetPropertyOwner(PropertyDescriptor pd)
|
public object GetPropertyOwner(PropertyDescriptor pd)
|
||||||
{ return this; }
|
{ return this; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called to get the properties of this type. Returns properties with certain
|
/// Called to get the properties of this type. Returns properties with certain
|
||||||
/// attributes. this restriction is not implemented here.
|
/// attributes. this restriction is not implemented here.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="attributes"></param>
|
/// <param name="attributes"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
|
public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
|
||||||
{ return GetProperties(); }
|
{ return GetProperties(); }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called to get the properties of this type.
|
/// Called to get the properties of this type.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public PropertyDescriptorCollection GetProperties()
|
public PropertyDescriptorCollection GetProperties()
|
||||||
{
|
{
|
||||||
// Create a collection object to hold property descriptors
|
// Create a collection object to hold property descriptors
|
||||||
PropertyDescriptorCollection pds = new PropertyDescriptorCollection(null);
|
PropertyDescriptorCollection pds = new PropertyDescriptorCollection(null);
|
||||||
// Iterate the list
|
// Iterate the list
|
||||||
for (int i = 0; i < this.Items.Count; i++)
|
for (int i = 0; i < this.Items.Count; i++)
|
||||||
{
|
{
|
||||||
// Create a property descriptor for the item and add to the property descriptor collection
|
// Create a property descriptor for the item and add to the property descriptor collection
|
||||||
ItemInfoListPropertyDescriptor pd = new ItemInfoListPropertyDescriptor(this, i);
|
ItemInfoListPropertyDescriptor pd = new ItemInfoListPropertyDescriptor(this, i);
|
||||||
pds.Add(pd);
|
pds.Add(pd);
|
||||||
}
|
}
|
||||||
// return the property descriptor collection
|
// return the property descriptor collection
|
||||||
return pds;
|
return pds;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
} // Class
|
} // Class
|
||||||
#region Property Descriptor
|
#region Property Descriptor
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Summary description for CollectionPropertyDescriptor.
|
/// Summary description for CollectionPropertyDescriptor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class ItemInfoListPropertyDescriptor : vlnListPropertyDescriptor
|
public partial class ItemInfoListPropertyDescriptor : vlnListPropertyDescriptor
|
||||||
{
|
{
|
||||||
private ItemInfo Item { get { return (ItemInfo)_Item; } }
|
private ItemInfo Item { get { return (ItemInfo)_Item; } }
|
||||||
public ItemInfoListPropertyDescriptor(ItemInfoList collection, int index) : base(collection, index) { ;}
|
public ItemInfoListPropertyDescriptor(ItemInfoList collection, int index) : base(collection, index) {; }
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Converter
|
#region Converter
|
||||||
internal class ItemInfoListConverter : ExpandableObjectConverter
|
internal class ItemInfoListConverter : ExpandableObjectConverter
|
||||||
{
|
{
|
||||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
{
|
{
|
||||||
if (destType == typeof(string) && value is ItemInfoList)
|
if (destType == typeof(string) && value is ItemInfoList)
|
||||||
{
|
{
|
||||||
// Return department and department role separated by comma.
|
// Return department and department role separated by comma.
|
||||||
return ((ItemInfoList)value).Items.Count.ToString() + " Items";
|
return ((ItemInfoList)value).Items.Count.ToString() + " Items";
|
||||||
}
|
}
|
||||||
return base.ConvertTo(context, culture, value, destType);
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
@ -20,472 +20,458 @@ using System.Collections.Generic;
|
|||||||
using Csla.Validation;
|
using Csla.Validation;
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ItemPart Generated by MyGeneration using the CSLA Object Mapping template
|
/// ItemPart Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
[TypeConverter(typeof(ItemPartConverter))]
|
[TypeConverter(typeof(ItemPartConverter))]
|
||||||
public partial class ItemPart : BusinessBase<ItemPart>, IVEHasBrokenRules, IDisposable
|
public partial class ItemPart : BusinessBase<ItemPart>, IVEHasBrokenRules, IDisposable
|
||||||
{
|
{
|
||||||
#region Log4Net
|
#region Log4Net
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#endregion
|
#endregion
|
||||||
#region Business Methods
|
#region Business Methods
|
||||||
private string _ErrorMessage = string.Empty;
|
private string _ErrorMessage = string.Empty;
|
||||||
public string ErrorMessage
|
public string ErrorMessage
|
||||||
{
|
{
|
||||||
get { return _ErrorMessage; }
|
get { return _ErrorMessage; }
|
||||||
}
|
}
|
||||||
private int _ContentID;
|
private int _ContentID;
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
public int ContentID
|
public int ContentID
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("ContentID", true);
|
if (_MyContent != null) _ContentID = _MyContent.ContentID;
|
||||||
if (_MyContent != null) _ContentID = _MyContent.ContentID;
|
return _ContentID;
|
||||||
return _ContentID;
|
}
|
||||||
}
|
}
|
||||||
}
|
private Content _MyContent;
|
||||||
private Content _MyContent;
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
public Content MyContent
|
||||||
public Content MyContent
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
get
|
||||||
get
|
{
|
||||||
{
|
if (_MyContent == null && _ContentID != 0) _MyContent = Content.Get(_ContentID);
|
||||||
CanReadProperty("MyContent", true);
|
return _MyContent;
|
||||||
if (_MyContent == null && _ContentID != 0) _MyContent = Content.Get(_ContentID);
|
}
|
||||||
return _MyContent;
|
}
|
||||||
}
|
private int _FromType;
|
||||||
}
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
private int _FromType;
|
public int FromType
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
{
|
||||||
public int FromType
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
return _FromType;
|
||||||
{
|
}
|
||||||
CanReadProperty("FromType", true);
|
}
|
||||||
return _FromType;
|
private DateTime _DTS = new DateTime();
|
||||||
}
|
public DateTime DTS
|
||||||
}
|
{
|
||||||
private DateTime _DTS = new DateTime();
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
public DateTime DTS
|
get
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
return _DTS;
|
||||||
get
|
}
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
CanReadProperty("DTS", true);
|
set
|
||||||
return _DTS;
|
{
|
||||||
}
|
if (_DTS != value)
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
set
|
_DTS = value;
|
||||||
{
|
PropertyHasChanged();
|
||||||
CanWriteProperty("DTS", true);
|
}
|
||||||
if (_DTS != value)
|
}
|
||||||
{
|
}
|
||||||
_DTS = value;
|
private string _UserID = string.Empty;
|
||||||
PropertyHasChanged();
|
public string UserID
|
||||||
}
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
private string _UserID = string.Empty;
|
{
|
||||||
public string UserID
|
return _UserID;
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
set
|
||||||
{
|
{
|
||||||
CanReadProperty("UserID", true);
|
if (value == null) value = string.Empty;
|
||||||
return _UserID;
|
if (_UserID != value)
|
||||||
}
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
_UserID = value;
|
||||||
set
|
PropertyHasChanged();
|
||||||
{
|
}
|
||||||
CanWriteProperty("UserID", true);
|
}
|
||||||
if (value == null) value = string.Empty;
|
}
|
||||||
if (_UserID != value)
|
private byte[] _LastChanged = new byte[8];//timestamp
|
||||||
{
|
private string _Content_Number = string.Empty;
|
||||||
_UserID = value;
|
/// <summary>
|
||||||
PropertyHasChanged();
|
/// Increased from 30 to 256 to support RTF symbols
|
||||||
}
|
/// </summary>
|
||||||
}
|
public string Content_Number
|
||||||
}
|
{
|
||||||
private byte[] _LastChanged = new byte[8];//timestamp
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
private string _Content_Number = string.Empty;
|
get
|
||||||
/// <summary>
|
{
|
||||||
/// Increased from 30 to 256 to support RTF symbols
|
return _Content_Number;
|
||||||
/// </summary>
|
}
|
||||||
public string Content_Number
|
}
|
||||||
{
|
private string _Content_Text = string.Empty;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
public string Content_Text
|
||||||
get
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
CanReadProperty("Content_Number", true);
|
get
|
||||||
return _Content_Number;
|
{
|
||||||
}
|
return _Content_Text;
|
||||||
}
|
}
|
||||||
private string _Content_Text = string.Empty;
|
}
|
||||||
public string Content_Text
|
private int? _Content_Type;
|
||||||
{
|
/// <summary>
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
/// 0 - Procedure, 10000 - Section, 20000 Step
|
||||||
get
|
/// </summary>
|
||||||
{
|
public int? Content_Type
|
||||||
CanReadProperty("Content_Text", true);
|
{
|
||||||
return _Content_Text;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
}
|
{
|
||||||
private int? _Content_Type;
|
return _Content_Type;
|
||||||
/// <summary>
|
}
|
||||||
/// 0 - Procedure, 10000 - Section, 20000 Step
|
}
|
||||||
/// </summary>
|
private int? _Content_FormatID;
|
||||||
public int? Content_Type
|
public int? Content_FormatID
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("Content_Type", true);
|
return _Content_FormatID;
|
||||||
return _Content_Type;
|
}
|
||||||
}
|
}
|
||||||
}
|
private string _Content_Config = string.Empty;
|
||||||
private int? _Content_FormatID;
|
public string Content_Config
|
||||||
public int? Content_FormatID
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
get
|
||||||
get
|
{
|
||||||
{
|
return _Content_Config;
|
||||||
CanReadProperty("Content_FormatID", true);
|
}
|
||||||
return _Content_FormatID;
|
}
|
||||||
}
|
private DateTime _Content_DTS = new DateTime();
|
||||||
}
|
public DateTime Content_DTS
|
||||||
private string _Content_Config = string.Empty;
|
{
|
||||||
public string Content_Config
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
return _Content_DTS;
|
||||||
{
|
}
|
||||||
CanReadProperty("Content_Config", true);
|
}
|
||||||
return _Content_Config;
|
private string _Content_UserID = string.Empty;
|
||||||
}
|
public string Content_UserID
|
||||||
}
|
{
|
||||||
private DateTime _Content_DTS = new DateTime();
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
public DateTime Content_DTS
|
get
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
return _Content_UserID;
|
||||||
get
|
}
|
||||||
{
|
}
|
||||||
CanReadProperty("Content_DTS", true);
|
// CSLATODO: Check ItemPart.GetIdValue to assure that the ID returned is unique
|
||||||
return _Content_DTS;
|
/// <summary>
|
||||||
}
|
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||||
}
|
/// </summary>
|
||||||
private string _Content_UserID = string.Empty;
|
/// <returns>A Unique ID for the current ItemPart</returns>
|
||||||
public string Content_UserID
|
protected override object GetIdValue()
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
return MyItemPartUnique; // Absolutely Unique ID
|
||||||
get
|
}
|
||||||
{
|
// CSLATODO: Replace base ItemPart.ToString function as necessary
|
||||||
CanReadProperty("Content_UserID", true);
|
/// <summary>
|
||||||
return _Content_UserID;
|
/// Overrides Base ToString
|
||||||
}
|
/// </summary>
|
||||||
}
|
/// <returns>A string representation of current ItemPart</returns>
|
||||||
// CSLATODO: Check ItemPart.GetIdValue to assure that the ID returned is unique
|
//public override string ToString()
|
||||||
/// <summary>
|
//{
|
||||||
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
// return base.ToString();
|
||||||
/// </summary>
|
//}
|
||||||
/// <returns>A Unique ID for the current ItemPart</returns>
|
public override bool IsDirty
|
||||||
protected override object GetIdValue()
|
{
|
||||||
{
|
get { return base.IsDirty; }
|
||||||
return MyItemPartUnique; // Absolutely Unique ID
|
}
|
||||||
}
|
public bool IsDirtyList(List<object> list)
|
||||||
// CSLATODO: Replace base ItemPart.ToString function as necessary
|
{
|
||||||
/// <summary>
|
return base.IsDirty;
|
||||||
/// Overrides Base ToString
|
}
|
||||||
/// </summary>
|
public override bool IsValid
|
||||||
/// <returns>A string representation of current ItemPart</returns>
|
{
|
||||||
//public override string ToString()
|
get { return (IsNew && !IsDirty) ? true : base.IsValid; }
|
||||||
//{
|
}
|
||||||
// return base.ToString();
|
public bool IsValidList(List<object> list)
|
||||||
//}
|
{
|
||||||
public override bool IsDirty
|
return (IsNew && !IsDirty) ? true : base.IsValid;
|
||||||
{
|
}
|
||||||
get { return base.IsDirty; }
|
#endregion
|
||||||
}
|
#region ValidationRules
|
||||||
public bool IsDirtyList(List<object> list)
|
[NonSerialized]
|
||||||
{
|
private bool _CheckingBrokenRules = false;
|
||||||
return base.IsDirty;
|
public IVEHasBrokenRules HasBrokenRules
|
||||||
}
|
{
|
||||||
public override bool IsValid
|
get
|
||||||
{
|
{
|
||||||
get { return (IsNew && !IsDirty) ? true : base.IsValid; }
|
if (_CheckingBrokenRules) return null;
|
||||||
}
|
if (BrokenRulesCollection.Count > 0) return this;
|
||||||
public bool IsValidList(List<object> list)
|
try
|
||||||
{
|
{
|
||||||
return (IsNew && !IsDirty) ? true : base.IsValid;
|
_CheckingBrokenRules = true;
|
||||||
}
|
IVEHasBrokenRules hasBrokenRules = null;
|
||||||
#endregion
|
return hasBrokenRules;
|
||||||
#region ValidationRules
|
}
|
||||||
[NonSerialized]
|
finally
|
||||||
private bool _CheckingBrokenRules = false;
|
{
|
||||||
public IVEHasBrokenRules HasBrokenRules
|
_CheckingBrokenRules = false;
|
||||||
{
|
}
|
||||||
get
|
}
|
||||||
{
|
}
|
||||||
if (_CheckingBrokenRules) return null;
|
public BrokenRulesCollection BrokenRules
|
||||||
if (BrokenRulesCollection.Count > 0) return this;
|
{
|
||||||
try
|
get
|
||||||
{
|
{
|
||||||
_CheckingBrokenRules = true;
|
IVEHasBrokenRules hasBrokenRules = HasBrokenRules;
|
||||||
IVEHasBrokenRules hasBrokenRules = null;
|
if (this.Equals(hasBrokenRules)) return BrokenRulesCollection;
|
||||||
return hasBrokenRules;
|
return (hasBrokenRules != null ? hasBrokenRules.BrokenRules : null);
|
||||||
}
|
}
|
||||||
finally
|
}
|
||||||
{
|
protected override void AddBusinessRules()
|
||||||
_CheckingBrokenRules = false;
|
{
|
||||||
}
|
ValidationRules.AddRule(
|
||||||
}
|
Csla.Validation.CommonRules.StringRequired, "UserID");
|
||||||
}
|
ValidationRules.AddRule(
|
||||||
public BrokenRulesCollection BrokenRules
|
Csla.Validation.CommonRules.StringMaxLength,
|
||||||
{
|
new Csla.Validation.CommonRules.MaxLengthRuleArgs("UserID", 100));
|
||||||
get
|
// CSLATODO: Add other validation rules
|
||||||
{
|
}
|
||||||
IVEHasBrokenRules hasBrokenRules = HasBrokenRules;
|
// Sample data comparison validation rule
|
||||||
if (this.Equals(hasBrokenRules)) return BrokenRulesCollection;
|
//private bool StartDateGTEndDate(object target, Csla.Validation.RuleArgs e)
|
||||||
return (hasBrokenRules != null ? hasBrokenRules.BrokenRules : null);
|
//{
|
||||||
}
|
// if (_started > _ended)
|
||||||
}
|
// {
|
||||||
protected override void AddBusinessRules()
|
// e.Description = "Start date can't be after end date";
|
||||||
{
|
// return false;
|
||||||
ValidationRules.AddRule(
|
// }
|
||||||
Csla.Validation.CommonRules.StringRequired, "UserID");
|
// else
|
||||||
ValidationRules.AddRule(
|
// return true;
|
||||||
Csla.Validation.CommonRules.StringMaxLength,
|
//}
|
||||||
new Csla.Validation.CommonRules.MaxLengthRuleArgs("UserID", 100));
|
#endregion
|
||||||
// CSLATODO: Add other validation rules
|
#region Authorization Rules
|
||||||
}
|
protected override void AddAuthorizationRules()
|
||||||
// Sample data comparison validation rule
|
{
|
||||||
//private bool StartDateGTEndDate(object target, Csla.Validation.RuleArgs e)
|
//CSLATODO: Who can read/write which fields
|
||||||
//{
|
//AuthorizationRules.AllowRead(ContentID, "<Role(s)>");
|
||||||
// if (_started > _ended)
|
//AuthorizationRules.AllowRead(FromType, "<Role(s)>");
|
||||||
// {
|
//AuthorizationRules.AllowRead(DTS, "<Role(s)>");
|
||||||
// e.Description = "Start date can't be after end date";
|
//AuthorizationRules.AllowWrite(DTS, "<Role(s)>");
|
||||||
// return false;
|
//AuthorizationRules.AllowRead(UserID, "<Role(s)>");
|
||||||
// }
|
//AuthorizationRules.AllowWrite(UserID, "<Role(s)>");
|
||||||
// else
|
}
|
||||||
// return true;
|
public static bool CanAddObject()
|
||||||
//}
|
{
|
||||||
#endregion
|
// CSLATODO: Can Add Authorization
|
||||||
#region Authorization Rules
|
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
|
||||||
protected override void AddAuthorizationRules()
|
return true;
|
||||||
{
|
}
|
||||||
//CSLATODO: Who can read/write which fields
|
public static bool CanGetObject()
|
||||||
//AuthorizationRules.AllowRead(ContentID, "<Role(s)>");
|
{
|
||||||
//AuthorizationRules.AllowRead(FromType, "<Role(s)>");
|
// CSLATODO: CanGet Authorization
|
||||||
//AuthorizationRules.AllowRead(DTS, "<Role(s)>");
|
return true;
|
||||||
//AuthorizationRules.AllowWrite(DTS, "<Role(s)>");
|
}
|
||||||
//AuthorizationRules.AllowRead(UserID, "<Role(s)>");
|
public static bool CanDeleteObject()
|
||||||
//AuthorizationRules.AllowWrite(UserID, "<Role(s)>");
|
{
|
||||||
}
|
// CSLATODO: CanDelete Authorization
|
||||||
public static bool CanAddObject()
|
//bool result = false;
|
||||||
{
|
//if (Csla.ApplicationContext.User.IsInRole("ProjectManager"))result = true;
|
||||||
// CSLATODO: Can Add Authorization
|
//if (Csla.ApplicationContext.User.IsInRole("Administrator"))result = true;
|
||||||
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
|
//return result;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public static bool CanGetObject()
|
public static bool CanEditObject()
|
||||||
{
|
{
|
||||||
// CSLATODO: CanGet Authorization
|
// CSLATODO: CanEdit Authorization
|
||||||
return true;
|
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
|
||||||
}
|
return true;
|
||||||
public static bool CanDeleteObject()
|
}
|
||||||
{
|
#endregion
|
||||||
// CSLATODO: CanDelete Authorization
|
#region Factory Methods
|
||||||
//bool result = false;
|
public int CurrentEditLevel
|
||||||
//if (Csla.ApplicationContext.User.IsInRole("ProjectManager"))result = true;
|
{ get { return EditLevel; } }
|
||||||
//if (Csla.ApplicationContext.User.IsInRole("Administrator"))result = true;
|
private static int _ItemPartUnique = 0;
|
||||||
//return result;
|
private static int ItemPartUnique
|
||||||
return true;
|
{ get { return ++_ItemPartUnique; } }
|
||||||
}
|
private int _MyItemPartUnique = ItemPartUnique;
|
||||||
public static bool CanEditObject()
|
public int MyItemPartUnique // Absolutely Unique ID - Editable FK
|
||||||
{
|
{ get { return _MyItemPartUnique; } }
|
||||||
// CSLATODO: CanEdit Authorization
|
internal static ItemPart New(Content myContent, int fromType)
|
||||||
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
|
{
|
||||||
return true;
|
return new ItemPart(myContent, fromType);
|
||||||
}
|
}
|
||||||
#endregion
|
internal static ItemPart Get(SafeDataReader dr)
|
||||||
#region Factory Methods
|
{
|
||||||
public int CurrentEditLevel
|
return new ItemPart(dr);
|
||||||
{ get { return EditLevel; } }
|
}
|
||||||
private static int _ItemPartUnique = 0;
|
public ItemPart()
|
||||||
private static int ItemPartUnique
|
{
|
||||||
{ get { return ++_ItemPartUnique; } }
|
MarkAsChild();
|
||||||
private int _MyItemPartUnique = ItemPartUnique;
|
|
||||||
public int MyItemPartUnique // Absolutely Unique ID - Editable FK
|
|
||||||
{ get { return _MyItemPartUnique; } }
|
|
||||||
internal static ItemPart New(Content myContent, int fromType)
|
|
||||||
{
|
|
||||||
return new ItemPart(myContent, fromType);
|
|
||||||
}
|
|
||||||
internal static ItemPart Get(SafeDataReader dr)
|
|
||||||
{
|
|
||||||
return new ItemPart(dr);
|
|
||||||
}
|
|
||||||
public ItemPart()
|
|
||||||
{
|
|
||||||
MarkAsChild();
|
|
||||||
|
|
||||||
_DTS = _ItemPartExtension.DefaultDTS;
|
_DTS = _ItemPartExtension.DefaultDTS;
|
||||||
_UserID = _ItemPartExtension.DefaultUserID;
|
_UserID = _ItemPartExtension.DefaultUserID;
|
||||||
ValidationRules.CheckRules();
|
ValidationRules.CheckRules();
|
||||||
}
|
}
|
||||||
private ItemPart(Content myContent, int fromType)
|
private ItemPart(Content myContent, int fromType)
|
||||||
{
|
{
|
||||||
MarkAsChild();
|
MarkAsChild();
|
||||||
// CSLATODO: Add any initialization & defaults
|
// CSLATODO: Add any initialization & defaults
|
||||||
_DTS = _ItemPartExtension.DefaultDTS;
|
_DTS = _ItemPartExtension.DefaultDTS;
|
||||||
_UserID = _ItemPartExtension.DefaultUserID;
|
_UserID = _ItemPartExtension.DefaultUserID;
|
||||||
_MyContent = myContent;
|
_MyContent = myContent;
|
||||||
_FromType = fromType;
|
_FromType = fromType;
|
||||||
ValidationRules.CheckRules();
|
ValidationRules.CheckRules();
|
||||||
}
|
}
|
||||||
internal ItemPart(SafeDataReader dr)
|
internal ItemPart(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
MarkAsChild();
|
MarkAsChild();
|
||||||
Fetch(dr);
|
Fetch(dr);
|
||||||
}
|
}
|
||||||
private bool _Disposed = false;
|
private bool _Disposed = false;
|
||||||
private static int _CountCreated = 0;
|
private static int _CountCreated = 0;
|
||||||
private static int _CountDisposed = 0;
|
private static int _CountDisposed = 0;
|
||||||
private static int _CountFinalized = 0;
|
private static int _CountFinalized = 0;
|
||||||
private static int IncrementCountCreated
|
private static int IncrementCountCreated
|
||||||
{ get { return ++_CountCreated; } }
|
{ get { return ++_CountCreated; } }
|
||||||
private int _CountWhenCreated = IncrementCountCreated;
|
private int _CountWhenCreated = IncrementCountCreated;
|
||||||
public static int CountCreated
|
public static int CountCreated
|
||||||
{ get { return _CountCreated; } }
|
{ get { return _CountCreated; } }
|
||||||
public static int CountNotDisposed
|
public static int CountNotDisposed
|
||||||
{ get { return _CountCreated - _CountDisposed; } }
|
{ get { return _CountCreated - _CountDisposed; } }
|
||||||
public static int CountNotFinalized
|
public static int CountNotFinalized
|
||||||
{ get { return _CountCreated - _CountFinalized; } }
|
{ get { return _CountCreated - _CountFinalized; } }
|
||||||
~ItemPart()
|
~ItemPart()
|
||||||
{
|
{
|
||||||
_CountFinalized++;
|
_CountFinalized++;
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
if (_Disposed) return;
|
if (_Disposed) return;
|
||||||
_CountDisposed++;
|
_CountDisposed++;
|
||||||
_Disposed = true;
|
_Disposed = true;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Data Access Portal
|
#region Data Access Portal
|
||||||
private void Fetch(SafeDataReader dr)
|
private void Fetch(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemPart.FetchDR", GetHashCode());
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemPart.FetchDR", GetHashCode());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_ContentID = dr.GetInt32("ContentID");
|
_ContentID = dr.GetInt32("ContentID");
|
||||||
_FromType = dr.GetInt32("FromType");
|
_FromType = dr.GetInt32("FromType");
|
||||||
_DTS = dr.GetDateTime("DTS");
|
_DTS = dr.GetDateTime("DTS");
|
||||||
_UserID = dr.GetString("UserID");
|
_UserID = dr.GetString("UserID");
|
||||||
dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
|
dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
|
||||||
_Content_Number = dr.GetString("Content_Number");
|
_Content_Number = dr.GetString("Content_Number");
|
||||||
_Content_Text = dr.GetString("Content_Text");
|
_Content_Text = dr.GetString("Content_Text");
|
||||||
_Content_Type = (int?)dr.GetValue("Content_Type");
|
_Content_Type = (int?)dr.GetValue("Content_Type");
|
||||||
_Content_FormatID = (int?)dr.GetValue("Content_FormatID");
|
_Content_FormatID = (int?)dr.GetValue("Content_FormatID");
|
||||||
_Content_Config = dr.GetString("Content_Config");
|
_Content_Config = dr.GetString("Content_Config");
|
||||||
_Content_DTS = dr.GetDateTime("Content_DTS");
|
_Content_DTS = dr.GetDateTime("Content_DTS");
|
||||||
_Content_UserID = dr.GetString("Content_UserID");
|
_Content_UserID = dr.GetString("Content_UserID");
|
||||||
}
|
}
|
||||||
catch (Exception ex) // FKItem Fetch
|
catch (Exception ex) // FKItem Fetch
|
||||||
{
|
{
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemPart.FetchDR", ex);
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemPart.FetchDR", ex);
|
||||||
throw new DbCslaException("ItemPart.Fetch", ex);
|
throw new DbCslaException("ItemPart.Fetch", ex);
|
||||||
}
|
}
|
||||||
MarkOld();
|
MarkOld();
|
||||||
}
|
}
|
||||||
internal void Insert(Item myItem)
|
internal void Insert(Item myItem)
|
||||||
{
|
{
|
||||||
// if we're not dirty then don't update the database
|
// if we're not dirty then don't update the database
|
||||||
if (!this.IsDirty) return;
|
if (!this.IsDirty) return;
|
||||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||||
_LastChanged = Part.Add(cn, _MyContent, _FromType, myItem, _DTS, _UserID);
|
_LastChanged = Part.Add(cn, _MyContent, _FromType, myItem, _DTS, _UserID);
|
||||||
MarkOld();
|
MarkOld();
|
||||||
}
|
}
|
||||||
internal void Update(Item myItem)
|
internal void Update(Item myItem)
|
||||||
{
|
{
|
||||||
// if we're not dirty then don't update the database
|
// if we're not dirty then don't update the database
|
||||||
if (!this.IsDirty) return;
|
if (!this.IsDirty) return;
|
||||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||||
_LastChanged = Part.Update(cn, _ContentID, _FromType, myItem.ItemID, _DTS, _UserID, ref _LastChanged);
|
_LastChanged = Part.Update(cn, _ContentID, _FromType, myItem.ItemID, _DTS, _UserID, ref _LastChanged);
|
||||||
MarkOld();
|
MarkOld();
|
||||||
}
|
}
|
||||||
internal void DeleteSelf(Item myItem)
|
internal void DeleteSelf(Item myItem)
|
||||||
{
|
{
|
||||||
// if we're not dirty then don't update the database
|
// if we're not dirty then don't update the database
|
||||||
if (!this.IsDirty) return;
|
if (!this.IsDirty) return;
|
||||||
// if we're new then don't update the database
|
// if we're new then don't update the database
|
||||||
if (this.IsNew) return;
|
if (this.IsNew) return;
|
||||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||||
Part.Remove(cn, _ContentID, _FromType);
|
Part.Remove(cn, _ContentID, _FromType);
|
||||||
MarkNew();
|
MarkNew();
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
// Standard Default Code
|
// Standard Default Code
|
||||||
#region extension
|
#region extension
|
||||||
ItemPartExtension _ItemPartExtension = new ItemPartExtension();
|
ItemPartExtension _ItemPartExtension = new ItemPartExtension();
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
partial class ItemPartExtension : extensionBase
|
partial class ItemPartExtension : extensionBase
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
class extensionBase
|
class extensionBase
|
||||||
{
|
{
|
||||||
// Default Values
|
// Default Values
|
||||||
public virtual DateTime DefaultDTS
|
public virtual DateTime DefaultDTS
|
||||||
{
|
{
|
||||||
get { return DateTime.Now; }
|
get { return DateTime.Now; }
|
||||||
}
|
}
|
||||||
public virtual string DefaultUserID
|
public virtual string DefaultUserID
|
||||||
{
|
{
|
||||||
get { return Volian.Base.Library.VlnSettings.UserID; }
|
get { return Volian.Base.Library.VlnSettings.UserID; }
|
||||||
}
|
}
|
||||||
// Authorization Rules
|
// Authorization Rules
|
||||||
public virtual void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
|
public virtual void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
|
||||||
{
|
{
|
||||||
// Needs to be overriden to add new authorization rules
|
// Needs to be overriden to add new authorization rules
|
||||||
}
|
}
|
||||||
// Instance Authorization Rules
|
// Instance Authorization Rules
|
||||||
public virtual void AddInstanceAuthorizationRules(Csla.Security.AuthorizationRules rules)
|
public virtual void AddInstanceAuthorizationRules(Csla.Security.AuthorizationRules rules)
|
||||||
{
|
{
|
||||||
// Needs to be overriden to add new authorization rules
|
// Needs to be overriden to add new authorization rules
|
||||||
}
|
}
|
||||||
// Validation Rules
|
// Validation Rules
|
||||||
public virtual void AddValidationRules(Csla.Validation.ValidationRules rules)
|
public virtual void AddValidationRules(Csla.Validation.ValidationRules rules)
|
||||||
{
|
{
|
||||||
// Needs to be overriden to add new validation rules
|
// Needs to be overriden to add new validation rules
|
||||||
}
|
}
|
||||||
// InstanceValidation Rules
|
// InstanceValidation Rules
|
||||||
public virtual void AddInstanceValidationRules(Csla.Validation.ValidationRules rules)
|
public virtual void AddInstanceValidationRules(Csla.Validation.ValidationRules rules)
|
||||||
{
|
{
|
||||||
// Needs to be overriden to add new validation rules
|
// Needs to be overriden to add new validation rules
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
} // Class
|
} // Class
|
||||||
#region Converter
|
#region Converter
|
||||||
internal class ItemPartConverter : ExpandableObjectConverter
|
internal class ItemPartConverter : ExpandableObjectConverter
|
||||||
{
|
{
|
||||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
{
|
{
|
||||||
if (destType == typeof(string) && value is ItemPart)
|
if (destType == typeof(string) && value is ItemPart)
|
||||||
{
|
{
|
||||||
// Return the ToString value
|
// Return the ToString value
|
||||||
return ((ItemPart)value).ToString();
|
return ((ItemPart)value).ToString();
|
||||||
}
|
}
|
||||||
return base.ConvertTo(context, culture, value, destType);
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -19,459 +19,449 @@ using System.ComponentModel;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
public delegate void MembershipInfoEvent(object sender);
|
public delegate void MembershipInfoEvent(object sender);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// MembershipInfo Generated by MyGeneration using the CSLA Object Mapping template
|
/// MembershipInfo Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
[TypeConverter(typeof(MembershipInfoConverter))]
|
[TypeConverter(typeof(MembershipInfoConverter))]
|
||||||
public partial class MembershipInfo : ReadOnlyBase<MembershipInfo>, IDisposable
|
public partial class MembershipInfo : ReadOnlyBase<MembershipInfo>, IDisposable
|
||||||
{
|
{
|
||||||
public event MembershipInfoEvent Changed;
|
public event MembershipInfoEvent Changed;
|
||||||
private void OnChange()
|
private void OnChange()
|
||||||
{
|
{
|
||||||
if (Changed != null) Changed(this);
|
if (Changed != null) Changed(this);
|
||||||
}
|
}
|
||||||
#region Log4Net
|
#region Log4Net
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
private static List<MembershipInfo> _CacheList = new List<MembershipInfo>();
|
private static List<MembershipInfo> _CacheList = new List<MembershipInfo>();
|
||||||
protected static void AddToCache(MembershipInfo membershipInfo)
|
protected static void AddToCache(MembershipInfo membershipInfo)
|
||||||
{
|
{
|
||||||
if (!_CacheList.Contains(membershipInfo)) _CacheList.Add(membershipInfo); // In AddToCache
|
if (!_CacheList.Contains(membershipInfo)) _CacheList.Add(membershipInfo); // In AddToCache
|
||||||
}
|
}
|
||||||
protected static void RemoveFromCache(MembershipInfo membershipInfo)
|
protected static void RemoveFromCache(MembershipInfo membershipInfo)
|
||||||
{
|
{
|
||||||
while (_CacheList.Contains(membershipInfo)) _CacheList.Remove(membershipInfo); // In RemoveFromCache
|
while (_CacheList.Contains(membershipInfo)) _CacheList.Remove(membershipInfo); // In RemoveFromCache
|
||||||
}
|
}
|
||||||
private static Dictionary<string, List<MembershipInfo>> _CacheByPrimaryKey = new Dictionary<string, List<MembershipInfo>>();
|
private static Dictionary<string, List<MembershipInfo>> _CacheByPrimaryKey = new Dictionary<string, List<MembershipInfo>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
while (_CacheList.Count > 0) // Move MembershipInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
while (_CacheList.Count > 0) // Move MembershipInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
||||||
{
|
{
|
||||||
MembershipInfo tmp = _CacheList[0]; // Get the first MembershipInfo
|
MembershipInfo tmp = _CacheList[0]; // Get the first MembershipInfo
|
||||||
string pKey = tmp.UGID.ToString();
|
string pKey = tmp.UGID.ToString();
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
||||||
{
|
{
|
||||||
_CacheByPrimaryKey[pKey] = new List<MembershipInfo>(); // Add new list for PrimaryKey
|
_CacheByPrimaryKey[pKey] = new List<MembershipInfo>(); // Add new list for PrimaryKey
|
||||||
}
|
}
|
||||||
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
||||||
_CacheList.RemoveAt(0); // Remove the first MembershipInfo
|
_CacheList.RemoveAt(0); // Remove the first MembershipInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
internal static void AddList(MembershipInfoList lst)
|
internal static void AddList(MembershipInfoList lst)
|
||||||
{
|
{
|
||||||
foreach (MembershipInfo item in lst) AddToCache(item);
|
foreach (MembershipInfo item in lst) AddToCache(item);
|
||||||
}
|
}
|
||||||
protected static MembershipInfo GetCachedByPrimaryKey(int ugid)
|
protected static MembershipInfo GetCachedByPrimaryKey(int ugid)
|
||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = ugid.ToString();
|
string key = ugid.ToString();
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Business Methods
|
#region Business Methods
|
||||||
private string _ErrorMessage = string.Empty;
|
private string _ErrorMessage = string.Empty;
|
||||||
public string ErrorMessage
|
public string ErrorMessage
|
||||||
{
|
{
|
||||||
get { return _ErrorMessage; }
|
get { return _ErrorMessage; }
|
||||||
}
|
}
|
||||||
protected Membership _Editable;
|
protected Membership _Editable;
|
||||||
private IVEHasBrokenRules HasBrokenRules
|
private IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
IVEHasBrokenRules hasBrokenRules = null;
|
IVEHasBrokenRules hasBrokenRules = null;
|
||||||
if (_Editable != null)
|
if (_Editable != null)
|
||||||
hasBrokenRules = _Editable.HasBrokenRules;
|
hasBrokenRules = _Editable.HasBrokenRules;
|
||||||
return hasBrokenRules;
|
return hasBrokenRules;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private int _UGID;
|
private int _UGID;
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
public int UGID
|
public int UGID
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("UGID", true);
|
return _UGID;
|
||||||
return _UGID;
|
}
|
||||||
}
|
}
|
||||||
}
|
private int _UID;
|
||||||
private int _UID;
|
public int UID
|
||||||
public int UID
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
get
|
||||||
get
|
{
|
||||||
{
|
if (_MyUser != null) _UID = _MyUser.UID;
|
||||||
CanReadProperty("UID", true);
|
return _UID;
|
||||||
if (_MyUser != null) _UID = _MyUser.UID;
|
}
|
||||||
return _UID;
|
}
|
||||||
}
|
private UserInfo _MyUser;
|
||||||
}
|
public UserInfo MyUser
|
||||||
private UserInfo _MyUser;
|
{
|
||||||
public UserInfo MyUser
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
if (_MyUser == null && _UID != 0) _MyUser = UserInfo.Get(_UID);
|
||||||
{
|
return _MyUser;
|
||||||
CanReadProperty("MyUser", true);
|
}
|
||||||
if (_MyUser == null && _UID != 0) _MyUser = UserInfo.Get(_UID);
|
}
|
||||||
return _MyUser;
|
private int _GID;
|
||||||
}
|
public int GID
|
||||||
}
|
{
|
||||||
private int _GID;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
public int GID
|
get
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
if (_MyGroup != null) _GID = _MyGroup.GID;
|
||||||
get
|
return _GID;
|
||||||
{
|
}
|
||||||
CanReadProperty("GID", true);
|
}
|
||||||
if (_MyGroup != null) _GID = _MyGroup.GID;
|
private GroupInfo _MyGroup;
|
||||||
return _GID;
|
public GroupInfo MyGroup
|
||||||
}
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
private GroupInfo _MyGroup;
|
get
|
||||||
public GroupInfo MyGroup
|
{
|
||||||
{
|
if (_MyGroup == null && _GID != 0) _MyGroup = GroupInfo.Get(_GID);
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
return _MyGroup;
|
||||||
get
|
}
|
||||||
{
|
}
|
||||||
CanReadProperty("MyGroup", true);
|
private string _StartDate = string.Empty;
|
||||||
if (_MyGroup == null && _GID != 0) _MyGroup = GroupInfo.Get(_GID);
|
public string StartDate
|
||||||
return _MyGroup;
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
private string _StartDate = string.Empty;
|
{
|
||||||
public string StartDate
|
return _StartDate;
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
private string _EndDate = string.Empty;
|
||||||
{
|
public string EndDate
|
||||||
CanReadProperty("StartDate", true);
|
{
|
||||||
return _StartDate;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
}
|
{
|
||||||
private string _EndDate = string.Empty;
|
return _EndDate;
|
||||||
public string EndDate
|
}
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
private string _Config = string.Empty;
|
||||||
get
|
public string Config
|
||||||
{
|
{
|
||||||
CanReadProperty("EndDate", true);
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
return _EndDate;
|
get
|
||||||
}
|
{
|
||||||
}
|
return _Config;
|
||||||
private string _Config = string.Empty;
|
}
|
||||||
public string Config
|
}
|
||||||
{
|
private DateTime _DTS = new DateTime();
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
public DateTime DTS
|
||||||
get
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
CanReadProperty("Config", true);
|
get
|
||||||
return _Config;
|
{
|
||||||
}
|
return _DTS;
|
||||||
}
|
}
|
||||||
private DateTime _DTS = new DateTime();
|
}
|
||||||
public DateTime DTS
|
private string _UsrID = string.Empty;
|
||||||
{
|
public string UsrID
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
CanReadProperty("DTS", true);
|
{
|
||||||
return _DTS;
|
return _UsrID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private string _UsrID = string.Empty;
|
// CSLATODO: Replace base MembershipInfo.ToString function as necessary
|
||||||
public string UsrID
|
/// <summary>
|
||||||
{
|
/// Overrides Base ToString
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
/// </summary>
|
||||||
get
|
/// <returns>A string representation of current MembershipInfo</returns>
|
||||||
{
|
//public override string ToString()
|
||||||
CanReadProperty("UsrID", true);
|
//{
|
||||||
return _UsrID;
|
// return base.ToString();
|
||||||
}
|
//}
|
||||||
}
|
// CSLATODO: Check MembershipInfo.GetIdValue to assure that the ID returned is unique
|
||||||
// CSLATODO: Replace base MembershipInfo.ToString function as necessary
|
/// <summary>
|
||||||
/// <summary>
|
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||||
/// Overrides Base ToString
|
/// </summary>
|
||||||
/// </summary>
|
/// <returns>A Unique ID for the current MembershipInfo</returns>
|
||||||
/// <returns>A string representation of current MembershipInfo</returns>
|
protected override object GetIdValue()
|
||||||
//public override string ToString()
|
{
|
||||||
//{
|
return MyMembershipInfoUnique; // Absolutely Unique ID
|
||||||
// return base.ToString();
|
}
|
||||||
//}
|
#endregion
|
||||||
// CSLATODO: Check MembershipInfo.GetIdValue to assure that the ID returned is unique
|
#region Factory Methods
|
||||||
/// <summary>
|
private static int _MembershipInfoUnique = 0;
|
||||||
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
private static int MembershipInfoUnique
|
||||||
/// </summary>
|
{ get { return ++_MembershipInfoUnique; } }
|
||||||
/// <returns>A Unique ID for the current MembershipInfo</returns>
|
private int _MyMembershipInfoUnique = MembershipInfoUnique;
|
||||||
protected override object GetIdValue()
|
public int MyMembershipInfoUnique // Absolutely Unique ID - Info
|
||||||
{
|
{ get { return _MyMembershipInfoUnique; } }
|
||||||
return MyMembershipInfoUnique; // Absolutely Unique ID
|
protected MembershipInfo()
|
||||||
}
|
{/* require use of factory methods */
|
||||||
#endregion
|
AddToCache(this);
|
||||||
#region Factory Methods
|
}
|
||||||
private static int _MembershipInfoUnique = 0;
|
private bool _Disposed = false;
|
||||||
private static int MembershipInfoUnique
|
private static int _CountCreated = 0;
|
||||||
{ get { return ++_MembershipInfoUnique; } }
|
private static int _CountDisposed = 0;
|
||||||
private int _MyMembershipInfoUnique = MembershipInfoUnique;
|
private static int _CountFinalized = 0;
|
||||||
public int MyMembershipInfoUnique // Absolutely Unique ID - Info
|
private static int IncrementCountCreated
|
||||||
{ get { return _MyMembershipInfoUnique; } }
|
{ get { return ++_CountCreated; } }
|
||||||
protected MembershipInfo()
|
private int _CountWhenCreated = IncrementCountCreated;
|
||||||
{/* require use of factory methods */
|
public static int CountCreated
|
||||||
AddToCache(this);
|
{ get { return _CountCreated; } }
|
||||||
}
|
public static int CountNotDisposed
|
||||||
private bool _Disposed = false;
|
{ get { return _CountCreated - _CountDisposed; } }
|
||||||
private static int _CountCreated = 0;
|
public static int CountNotFinalized
|
||||||
private static int _CountDisposed = 0;
|
{ get { return _CountCreated - _CountFinalized; } }
|
||||||
private static int _CountFinalized = 0;
|
~MembershipInfo()
|
||||||
private static int IncrementCountCreated
|
{
|
||||||
{ get { return ++_CountCreated; } }
|
_CountFinalized++;
|
||||||
private int _CountWhenCreated = IncrementCountCreated;
|
}
|
||||||
public static int CountCreated
|
public void Dispose()
|
||||||
{ get { return _CountCreated; } }
|
{
|
||||||
public static int CountNotDisposed
|
if (_Disposed) return;
|
||||||
{ get { return _CountCreated - _CountDisposed; } }
|
_CountDisposed++;
|
||||||
public static int CountNotFinalized
|
_Disposed = true;
|
||||||
{ get { return _CountCreated - _CountFinalized; } }
|
RemoveFromCache(this);
|
||||||
~MembershipInfo()
|
if (!_CacheByPrimaryKey.ContainsKey(UGID.ToString())) return;
|
||||||
{
|
List<MembershipInfo> listMembershipInfo = _CacheByPrimaryKey[UGID.ToString()]; // Get the list of items
|
||||||
_CountFinalized++;
|
while (listMembershipInfo.Contains(this)) listMembershipInfo.Remove(this); // Remove the item from the list
|
||||||
}
|
if (listMembershipInfo.Count == 0) // If there are no items left in the list
|
||||||
public void Dispose()
|
_CacheByPrimaryKey.Remove(UGID.ToString()); // remove the list
|
||||||
{
|
}
|
||||||
if (_Disposed) return;
|
public virtual Membership Get()
|
||||||
_CountDisposed++;
|
{
|
||||||
_Disposed = true;
|
return _Editable = Membership.Get(_UGID);
|
||||||
RemoveFromCache(this);
|
}
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(UGID.ToString())) return;
|
public static void Refresh(Membership tmp)
|
||||||
List<MembershipInfo> listMembershipInfo = _CacheByPrimaryKey[UGID.ToString()]; // Get the list of items
|
{
|
||||||
while (listMembershipInfo.Contains(this)) listMembershipInfo.Remove(this); // Remove the item from the list
|
string key = tmp.UGID.ToString();
|
||||||
if (listMembershipInfo.Count == 0) // If there are no items left in the list
|
ConvertListToDictionary();
|
||||||
_CacheByPrimaryKey.Remove(UGID.ToString()); // remove the list
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
}
|
foreach (MembershipInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
public virtual Membership Get()
|
tmpInfo.RefreshFields(tmp);
|
||||||
{
|
}
|
||||||
return _Editable = Membership.Get(_UGID);
|
protected virtual void RefreshFields(Membership tmp)
|
||||||
}
|
{
|
||||||
public static void Refresh(Membership tmp)
|
if (_UID != tmp.UID)
|
||||||
{
|
{
|
||||||
string key = tmp.UGID.ToString();
|
if (MyUser != null) MyUser.RefreshUserMemberships(); // Update List for old value
|
||||||
ConvertListToDictionary();
|
_UID = tmp.UID; // Update the value
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
}
|
||||||
foreach (MembershipInfo tmpInfo in _CacheByPrimaryKey[key])
|
_MyUser = null; // Reset list so that the next line gets a new list
|
||||||
tmpInfo.RefreshFields(tmp);
|
if (MyUser != null) MyUser.RefreshUserMemberships(); // Update List for new value
|
||||||
}
|
if (_GID != tmp.GID)
|
||||||
protected virtual void RefreshFields(Membership tmp)
|
{
|
||||||
{
|
if (MyGroup != null) MyGroup.RefreshGroupMemberships(); // Update List for old value
|
||||||
if (_UID != tmp.UID)
|
_GID = tmp.GID; // Update the value
|
||||||
{
|
}
|
||||||
if (MyUser != null) MyUser.RefreshUserMemberships(); // Update List for old value
|
_MyGroup = null; // Reset list so that the next line gets a new list
|
||||||
_UID = tmp.UID; // Update the value
|
if (MyGroup != null) MyGroup.RefreshGroupMemberships(); // Update List for new value
|
||||||
}
|
_StartDate = tmp.StartDate;
|
||||||
_MyUser = null; // Reset list so that the next line gets a new list
|
_EndDate = tmp.EndDate;
|
||||||
if (MyUser != null) MyUser.RefreshUserMemberships(); // Update List for new value
|
_Config = tmp.Config;
|
||||||
if (_GID != tmp.GID)
|
_DTS = tmp.DTS;
|
||||||
{
|
_UsrID = tmp.UsrID;
|
||||||
if (MyGroup != null) MyGroup.RefreshGroupMemberships(); // Update List for old value
|
_MembershipInfoExtension.Refresh(this);
|
||||||
_GID = tmp.GID; // Update the value
|
OnChange();// raise an event
|
||||||
}
|
}
|
||||||
_MyGroup = null; // Reset list so that the next line gets a new list
|
public static void Refresh(GroupMembership tmp)
|
||||||
if (MyGroup != null) MyGroup.RefreshGroupMemberships(); // Update List for new value
|
{
|
||||||
_StartDate = tmp.StartDate;
|
string key = tmp.UGID.ToString();
|
||||||
_EndDate = tmp.EndDate;
|
ConvertListToDictionary();
|
||||||
_Config = tmp.Config;
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
_DTS = tmp.DTS;
|
foreach (MembershipInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
_UsrID = tmp.UsrID;
|
tmpInfo.RefreshFields(tmp);
|
||||||
_MembershipInfoExtension.Refresh(this);
|
}
|
||||||
OnChange();// raise an event
|
protected virtual void RefreshFields(GroupMembership tmp)
|
||||||
}
|
{
|
||||||
public static void Refresh(GroupMembership tmp)
|
if (_UID != tmp.UID)
|
||||||
{
|
{
|
||||||
string key = tmp.UGID.ToString();
|
if (MyUser != null) MyUser.RefreshUserMemberships(); // Update List for old value
|
||||||
ConvertListToDictionary();
|
_UID = tmp.UID; // Update the value
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
}
|
||||||
foreach (MembershipInfo tmpInfo in _CacheByPrimaryKey[key])
|
_MyUser = null; // Reset list so that the next line gets a new list
|
||||||
tmpInfo.RefreshFields(tmp);
|
if (MyUser != null) MyUser.RefreshUserMemberships(); // Update List for new value
|
||||||
}
|
_StartDate = tmp.StartDate;
|
||||||
protected virtual void RefreshFields(GroupMembership tmp)
|
_EndDate = tmp.EndDate;
|
||||||
{
|
_Config = tmp.Config;
|
||||||
if (_UID != tmp.UID)
|
_DTS = tmp.DTS;
|
||||||
{
|
_UsrID = tmp.UsrID;
|
||||||
if (MyUser != null) MyUser.RefreshUserMemberships(); // Update List for old value
|
_MembershipInfoExtension.Refresh(this);
|
||||||
_UID = tmp.UID; // Update the value
|
OnChange();// raise an event
|
||||||
}
|
}
|
||||||
_MyUser = null; // Reset list so that the next line gets a new list
|
public static void Refresh(UserMembership tmp)
|
||||||
if (MyUser != null) MyUser.RefreshUserMemberships(); // Update List for new value
|
{
|
||||||
_StartDate = tmp.StartDate;
|
string key = tmp.UGID.ToString();
|
||||||
_EndDate = tmp.EndDate;
|
ConvertListToDictionary();
|
||||||
_Config = tmp.Config;
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
_DTS = tmp.DTS;
|
foreach (MembershipInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
_UsrID = tmp.UsrID;
|
tmpInfo.RefreshFields(tmp);
|
||||||
_MembershipInfoExtension.Refresh(this);
|
}
|
||||||
OnChange();// raise an event
|
protected virtual void RefreshFields(UserMembership tmp)
|
||||||
}
|
{
|
||||||
public static void Refresh(UserMembership tmp)
|
if (_GID != tmp.GID)
|
||||||
{
|
{
|
||||||
string key = tmp.UGID.ToString();
|
if (MyGroup != null) MyGroup.RefreshGroupMemberships(); // Update List for old value
|
||||||
ConvertListToDictionary();
|
_GID = tmp.GID; // Update the value
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
}
|
||||||
foreach (MembershipInfo tmpInfo in _CacheByPrimaryKey[key])
|
_MyGroup = null; // Reset list so that the next line gets a new list
|
||||||
tmpInfo.RefreshFields(tmp);
|
if (MyGroup != null) MyGroup.RefreshGroupMemberships(); // Update List for new value
|
||||||
}
|
_StartDate = tmp.StartDate;
|
||||||
protected virtual void RefreshFields(UserMembership tmp)
|
_EndDate = tmp.EndDate;
|
||||||
{
|
_Config = tmp.Config;
|
||||||
if (_GID != tmp.GID)
|
_DTS = tmp.DTS;
|
||||||
{
|
_UsrID = tmp.UsrID;
|
||||||
if (MyGroup != null) MyGroup.RefreshGroupMemberships(); // Update List for old value
|
_MembershipInfoExtension.Refresh(this);
|
||||||
_GID = tmp.GID; // Update the value
|
OnChange();// raise an event
|
||||||
}
|
}
|
||||||
_MyGroup = null; // Reset list so that the next line gets a new list
|
public static MembershipInfo Get(int ugid)
|
||||||
if (MyGroup != null) MyGroup.RefreshGroupMemberships(); // Update List for new value
|
{
|
||||||
_StartDate = tmp.StartDate;
|
//if (!CanGetObject())
|
||||||
_EndDate = tmp.EndDate;
|
// throw new System.Security.SecurityException("User not authorized to view a Membership");
|
||||||
_Config = tmp.Config;
|
try
|
||||||
_DTS = tmp.DTS;
|
{
|
||||||
_UsrID = tmp.UsrID;
|
MembershipInfo tmp = GetCachedByPrimaryKey(ugid);
|
||||||
_MembershipInfoExtension.Refresh(this);
|
if (tmp == null)
|
||||||
OnChange();// raise an event
|
{
|
||||||
}
|
tmp = DataPortal.Fetch<MembershipInfo>(new PKCriteria(ugid));
|
||||||
public static MembershipInfo Get(int ugid)
|
AddToCache(tmp);
|
||||||
{
|
}
|
||||||
//if (!CanGetObject())
|
if (tmp.ErrorMessage == "No Record Found")
|
||||||
// throw new System.Security.SecurityException("User not authorized to view a Membership");
|
{
|
||||||
try
|
tmp.Dispose(); // Clean-up MembershipInfo
|
||||||
{
|
tmp = null;
|
||||||
MembershipInfo tmp = GetCachedByPrimaryKey(ugid);
|
}
|
||||||
if (tmp == null)
|
return tmp;
|
||||||
{
|
}
|
||||||
tmp = DataPortal.Fetch<MembershipInfo>(new PKCriteria(ugid));
|
catch (Exception ex)
|
||||||
AddToCache(tmp);
|
{
|
||||||
}
|
throw new DbCslaException("Error on MembershipInfo.Get", ex);
|
||||||
if (tmp.ErrorMessage == "No Record Found")
|
}
|
||||||
{
|
}
|
||||||
tmp.Dispose(); // Clean-up MembershipInfo
|
#endregion
|
||||||
tmp = null;
|
#region Data Access Portal
|
||||||
}
|
internal MembershipInfo(SafeDataReader dr)
|
||||||
return tmp;
|
{
|
||||||
}
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] MembershipInfo.Constructor", GetHashCode());
|
||||||
catch (Exception ex)
|
try
|
||||||
{
|
{
|
||||||
throw new DbCslaException("Error on MembershipInfo.Get", ex);
|
ReadData(dr);
|
||||||
}
|
}
|
||||||
}
|
catch (Exception ex)
|
||||||
#endregion
|
{
|
||||||
#region Data Access Portal
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("MembershipInfo.Constructor", ex);
|
||||||
internal MembershipInfo(SafeDataReader dr)
|
throw new DbCslaException("MembershipInfo.Constructor", ex);
|
||||||
{
|
}
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] MembershipInfo.Constructor", GetHashCode());
|
}
|
||||||
try
|
[Serializable()]
|
||||||
{
|
protected class PKCriteria
|
||||||
ReadData(dr);
|
{
|
||||||
}
|
private int _UGID;
|
||||||
catch (Exception ex)
|
public int UGID
|
||||||
{
|
{ get { return _UGID; } }
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("MembershipInfo.Constructor", ex);
|
public PKCriteria(int ugid)
|
||||||
throw new DbCslaException("MembershipInfo.Constructor", ex);
|
{
|
||||||
}
|
_UGID = ugid;
|
||||||
}
|
}
|
||||||
[Serializable()]
|
}
|
||||||
protected class PKCriteria
|
private void ReadData(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
private int _UGID;
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] MembershipInfo.ReadData", GetHashCode());
|
||||||
public int UGID
|
try
|
||||||
{ get { return _UGID; } }
|
{
|
||||||
public PKCriteria(int ugid)
|
_UGID = dr.GetInt32("UGID");
|
||||||
{
|
_UID = dr.GetInt32("UID");
|
||||||
_UGID = ugid;
|
_GID = dr.GetInt32("GID");
|
||||||
}
|
_StartDate = dr.GetSmartDate("StartDate").Text;
|
||||||
}
|
_EndDate = dr.GetSmartDate("EndDate").Text;
|
||||||
private void ReadData(SafeDataReader dr)
|
_Config = dr.GetString("Config");
|
||||||
{
|
_DTS = dr.GetDateTime("DTS");
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] MembershipInfo.ReadData", GetHashCode());
|
_UsrID = dr.GetString("UsrID");
|
||||||
try
|
}
|
||||||
{
|
catch (Exception ex)
|
||||||
_UGID = dr.GetInt32("UGID");
|
{
|
||||||
_UID = dr.GetInt32("UID");
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("MembershipInfo.ReadData", ex);
|
||||||
_GID = dr.GetInt32("GID");
|
_ErrorMessage = ex.Message;
|
||||||
_StartDate = dr.GetSmartDate("StartDate").Text;
|
throw new DbCslaException("MembershipInfo.ReadData", ex);
|
||||||
_EndDate = dr.GetSmartDate("EndDate").Text;
|
}
|
||||||
_Config = dr.GetString("Config");
|
}
|
||||||
_DTS = dr.GetDateTime("DTS");
|
private void DataPortal_Fetch(PKCriteria criteria)
|
||||||
_UsrID = dr.GetString("UsrID");
|
{
|
||||||
}
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] MembershipInfo.DataPortal_Fetch", GetHashCode());
|
||||||
catch (Exception ex)
|
try
|
||||||
{
|
{
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("MembershipInfo.ReadData", ex);
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
_ErrorMessage = ex.Message;
|
{
|
||||||
throw new DbCslaException("MembershipInfo.ReadData", ex);
|
ApplicationContext.LocalContext["cn"] = cn;
|
||||||
}
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
}
|
{
|
||||||
private void DataPortal_Fetch(PKCriteria criteria)
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
{
|
cm.CommandText = "getMembership";
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] MembershipInfo.DataPortal_Fetch", GetHashCode());
|
cm.Parameters.AddWithValue("@UGID", criteria.UGID);
|
||||||
try
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
{
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
{
|
||||||
{
|
if (!dr.Read())
|
||||||
ApplicationContext.LocalContext["cn"] = cn;
|
{
|
||||||
using (SqlCommand cm = cn.CreateCommand())
|
_ErrorMessage = "No Record Found";
|
||||||
{
|
return;
|
||||||
cm.CommandType = CommandType.StoredProcedure;
|
}
|
||||||
cm.CommandText = "getMembership";
|
ReadData(dr);
|
||||||
cm.Parameters.AddWithValue("@UGID", criteria.UGID);
|
}
|
||||||
cm.CommandTimeout = Database.DefaultTimeout;
|
}
|
||||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
// removing of item only needed for local data portal
|
||||||
{
|
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
||||||
if (!dr.Read())
|
ApplicationContext.LocalContext.Remove("cn");
|
||||||
{
|
}
|
||||||
_ErrorMessage = "No Record Found";
|
}
|
||||||
return;
|
catch (Exception ex)
|
||||||
}
|
{
|
||||||
ReadData(dr);
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("MembershipInfo.DataPortal_Fetch", ex);
|
||||||
}
|
_ErrorMessage = ex.Message;
|
||||||
}
|
throw new DbCslaException("MembershipInfo.DataPortal_Fetch", ex);
|
||||||
// removing of item only needed for local data portal
|
}
|
||||||
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
}
|
||||||
ApplicationContext.LocalContext.Remove("cn");
|
#endregion
|
||||||
}
|
// Standard Refresh
|
||||||
}
|
#region extension
|
||||||
catch (Exception ex)
|
MembershipInfoExtension _MembershipInfoExtension = new MembershipInfoExtension();
|
||||||
{
|
[Serializable()]
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("MembershipInfo.DataPortal_Fetch", ex);
|
partial class MembershipInfoExtension : extensionBase { }
|
||||||
_ErrorMessage = ex.Message;
|
[Serializable()]
|
||||||
throw new DbCslaException("MembershipInfo.DataPortal_Fetch", ex);
|
class extensionBase
|
||||||
}
|
{
|
||||||
}
|
// Default Refresh
|
||||||
#endregion
|
public virtual void Refresh(MembershipInfo tmp) { }
|
||||||
// Standard Refresh
|
}
|
||||||
#region extension
|
#endregion
|
||||||
MembershipInfoExtension _MembershipInfoExtension = new MembershipInfoExtension();
|
} // Class
|
||||||
[Serializable()]
|
#region Converter
|
||||||
partial class MembershipInfoExtension : extensionBase { }
|
internal class MembershipInfoConverter : ExpandableObjectConverter
|
||||||
[Serializable()]
|
{
|
||||||
class extensionBase
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
{
|
{
|
||||||
// Default Refresh
|
if (destType == typeof(string) && value is MembershipInfo)
|
||||||
public virtual void Refresh(MembershipInfo tmp) { }
|
{
|
||||||
}
|
// Return the ToString value
|
||||||
#endregion
|
return ((MembershipInfo)value).ToString();
|
||||||
} // Class
|
}
|
||||||
#region Converter
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
internal class MembershipInfoConverter : ExpandableObjectConverter
|
}
|
||||||
{
|
}
|
||||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
#endregion
|
||||||
{
|
|
||||||
if (destType == typeof(string) && value is MembershipInfo)
|
|
||||||
{
|
|
||||||
// Return the ToString value
|
|
||||||
return ((MembershipInfo)value).ToString();
|
|
||||||
}
|
|
||||||
return base.ConvertTo(context, culture, value, destType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -19,337 +19,332 @@ using System.ComponentModel;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
public delegate void OwnerInfoEvent(object sender);
|
public delegate void OwnerInfoEvent(object sender);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// OwnerInfo Generated by MyGeneration using the CSLA Object Mapping template
|
/// OwnerInfo Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
[TypeConverter(typeof(OwnerInfoConverter))]
|
[TypeConverter(typeof(OwnerInfoConverter))]
|
||||||
public partial class OwnerInfo : ReadOnlyBase<OwnerInfo>, IDisposable
|
public partial class OwnerInfo : ReadOnlyBase<OwnerInfo>, IDisposable
|
||||||
{
|
{
|
||||||
public event OwnerInfoEvent Changed;
|
public event OwnerInfoEvent Changed;
|
||||||
private void OnChange()
|
private void OnChange()
|
||||||
{
|
{
|
||||||
if (Changed != null) Changed(this);
|
if (Changed != null) Changed(this);
|
||||||
}
|
}
|
||||||
#region Log4Net
|
#region Log4Net
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
private static List<OwnerInfo> _CacheList = new List<OwnerInfo>();
|
private static List<OwnerInfo> _CacheList = new List<OwnerInfo>();
|
||||||
protected static void AddToCache(OwnerInfo ownerInfo)
|
protected static void AddToCache(OwnerInfo ownerInfo)
|
||||||
{
|
{
|
||||||
if (!_CacheList.Contains(ownerInfo)) _CacheList.Add(ownerInfo); // In AddToCache
|
if (!_CacheList.Contains(ownerInfo)) _CacheList.Add(ownerInfo); // In AddToCache
|
||||||
}
|
}
|
||||||
protected static void RemoveFromCache(OwnerInfo ownerInfo)
|
protected static void RemoveFromCache(OwnerInfo ownerInfo)
|
||||||
{
|
{
|
||||||
while (_CacheList.Contains(ownerInfo)) _CacheList.Remove(ownerInfo); // In RemoveFromCache
|
while (_CacheList.Contains(ownerInfo)) _CacheList.Remove(ownerInfo); // In RemoveFromCache
|
||||||
}
|
}
|
||||||
private static Dictionary<string, List<OwnerInfo>> _CacheByPrimaryKey = new Dictionary<string, List<OwnerInfo>>();
|
private static Dictionary<string, List<OwnerInfo>> _CacheByPrimaryKey = new Dictionary<string, List<OwnerInfo>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
while (_CacheList.Count > 0) // Move OwnerInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
while (_CacheList.Count > 0) // Move OwnerInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
||||||
{
|
{
|
||||||
OwnerInfo tmp = _CacheList[0]; // Get the first OwnerInfo
|
OwnerInfo tmp = _CacheList[0]; // Get the first OwnerInfo
|
||||||
string pKey = tmp.OwnerID.ToString();
|
string pKey = tmp.OwnerID.ToString();
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
||||||
{
|
{
|
||||||
_CacheByPrimaryKey[pKey] = new List<OwnerInfo>(); // Add new list for PrimaryKey
|
_CacheByPrimaryKey[pKey] = new List<OwnerInfo>(); // Add new list for PrimaryKey
|
||||||
}
|
}
|
||||||
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
||||||
_CacheList.RemoveAt(0); // Remove the first OwnerInfo
|
_CacheList.RemoveAt(0); // Remove the first OwnerInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
internal static void AddList(OwnerInfoList lst)
|
internal static void AddList(OwnerInfoList lst)
|
||||||
{
|
{
|
||||||
foreach (OwnerInfo item in lst) AddToCache(item);
|
foreach (OwnerInfo item in lst) AddToCache(item);
|
||||||
}
|
}
|
||||||
protected static OwnerInfo GetCachedByPrimaryKey(int ownerID)
|
protected static OwnerInfo GetCachedByPrimaryKey(int ownerID)
|
||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = ownerID.ToString();
|
string key = ownerID.ToString();
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Business Methods
|
#region Business Methods
|
||||||
private string _ErrorMessage = string.Empty;
|
private string _ErrorMessage = string.Empty;
|
||||||
public string ErrorMessage
|
public string ErrorMessage
|
||||||
{
|
{
|
||||||
get { return _ErrorMessage; }
|
get { return _ErrorMessage; }
|
||||||
}
|
}
|
||||||
protected Owner _Editable;
|
protected Owner _Editable;
|
||||||
private IVEHasBrokenRules HasBrokenRules
|
private IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
IVEHasBrokenRules hasBrokenRules = null;
|
IVEHasBrokenRules hasBrokenRules = null;
|
||||||
if (_Editable != null)
|
if (_Editable != null)
|
||||||
hasBrokenRules = _Editable.HasBrokenRules;
|
hasBrokenRules = _Editable.HasBrokenRules;
|
||||||
return hasBrokenRules;
|
return hasBrokenRules;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private int _OwnerID;
|
private int _OwnerID;
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
public int OwnerID
|
public int OwnerID
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("OwnerID", true);
|
return _OwnerID;
|
||||||
return _OwnerID;
|
}
|
||||||
}
|
}
|
||||||
}
|
private int _SessionID;
|
||||||
private int _SessionID;
|
public int SessionID
|
||||||
public int SessionID
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
get
|
||||||
get
|
{
|
||||||
{
|
return _SessionID;
|
||||||
CanReadProperty("SessionID", true);
|
}
|
||||||
return _SessionID;
|
}
|
||||||
}
|
private byte _OwnerType;
|
||||||
}
|
public byte OwnerType
|
||||||
private byte _OwnerType;
|
{
|
||||||
public byte OwnerType
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
return _OwnerType;
|
||||||
{
|
}
|
||||||
CanReadProperty("OwnerType", true);
|
}
|
||||||
return _OwnerType;
|
private int _OwnerItemID;
|
||||||
}
|
public int OwnerItemID
|
||||||
}
|
{
|
||||||
private int _OwnerItemID;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
public int OwnerItemID
|
get
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
return _OwnerItemID;
|
||||||
get
|
}
|
||||||
{
|
}
|
||||||
CanReadProperty("OwnerItemID", true);
|
private DateTime _DTSStart = new DateTime();
|
||||||
return _OwnerItemID;
|
public DateTime DTSStart
|
||||||
}
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
private DateTime _DTSStart = new DateTime();
|
get
|
||||||
public DateTime DTSStart
|
{
|
||||||
{
|
return _DTSStart;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
}
|
||||||
{
|
// CSLATODO: Replace base OwnerInfo.ToString function as necessary
|
||||||
CanReadProperty("DTSStart", true);
|
/// <summary>
|
||||||
return _DTSStart;
|
/// Overrides Base ToString
|
||||||
}
|
/// </summary>
|
||||||
}
|
/// <returns>A string representation of current OwnerInfo</returns>
|
||||||
// CSLATODO: Replace base OwnerInfo.ToString function as necessary
|
//public override string ToString()
|
||||||
/// <summary>
|
//{
|
||||||
/// Overrides Base ToString
|
// return base.ToString();
|
||||||
/// </summary>
|
//}
|
||||||
/// <returns>A string representation of current OwnerInfo</returns>
|
// CSLATODO: Check OwnerInfo.GetIdValue to assure that the ID returned is unique
|
||||||
//public override string ToString()
|
/// <summary>
|
||||||
//{
|
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||||
// return base.ToString();
|
/// </summary>
|
||||||
//}
|
/// <returns>A Unique ID for the current OwnerInfo</returns>
|
||||||
// CSLATODO: Check OwnerInfo.GetIdValue to assure that the ID returned is unique
|
protected override object GetIdValue()
|
||||||
/// <summary>
|
{
|
||||||
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
return MyOwnerInfoUnique; // Absolutely Unique ID
|
||||||
/// </summary>
|
}
|
||||||
/// <returns>A Unique ID for the current OwnerInfo</returns>
|
#endregion
|
||||||
protected override object GetIdValue()
|
#region Factory Methods
|
||||||
{
|
private static int _OwnerInfoUnique = 0;
|
||||||
return MyOwnerInfoUnique; // Absolutely Unique ID
|
private static int OwnerInfoUnique
|
||||||
}
|
{ get { return ++_OwnerInfoUnique; } }
|
||||||
#endregion
|
private int _MyOwnerInfoUnique = OwnerInfoUnique;
|
||||||
#region Factory Methods
|
public int MyOwnerInfoUnique // Absolutely Unique ID - Info
|
||||||
private static int _OwnerInfoUnique = 0;
|
{ get { return _MyOwnerInfoUnique; } }
|
||||||
private static int OwnerInfoUnique
|
protected OwnerInfo()
|
||||||
{ get { return ++_OwnerInfoUnique; } }
|
{/* require use of factory methods */
|
||||||
private int _MyOwnerInfoUnique = OwnerInfoUnique;
|
AddToCache(this);
|
||||||
public int MyOwnerInfoUnique // Absolutely Unique ID - Info
|
}
|
||||||
{ get { return _MyOwnerInfoUnique; } }
|
private bool _Disposed = false;
|
||||||
protected OwnerInfo()
|
private static int _CountCreated = 0;
|
||||||
{/* require use of factory methods */
|
private static int _CountDisposed = 0;
|
||||||
AddToCache(this);
|
private static int _CountFinalized = 0;
|
||||||
}
|
private static int IncrementCountCreated
|
||||||
private bool _Disposed = false;
|
{ get { return ++_CountCreated; } }
|
||||||
private static int _CountCreated = 0;
|
private int _CountWhenCreated = IncrementCountCreated;
|
||||||
private static int _CountDisposed = 0;
|
public static int CountCreated
|
||||||
private static int _CountFinalized = 0;
|
{ get { return _CountCreated; } }
|
||||||
private static int IncrementCountCreated
|
public static int CountNotDisposed
|
||||||
{ get { return ++_CountCreated; } }
|
{ get { return _CountCreated - _CountDisposed; } }
|
||||||
private int _CountWhenCreated = IncrementCountCreated;
|
public static int CountNotFinalized
|
||||||
public static int CountCreated
|
{ get { return _CountCreated - _CountFinalized; } }
|
||||||
{ get { return _CountCreated; } }
|
~OwnerInfo()
|
||||||
public static int CountNotDisposed
|
{
|
||||||
{ get { return _CountCreated - _CountDisposed; } }
|
_CountFinalized++;
|
||||||
public static int CountNotFinalized
|
}
|
||||||
{ get { return _CountCreated - _CountFinalized; } }
|
public void Dispose()
|
||||||
~OwnerInfo()
|
{
|
||||||
{
|
if (_Disposed) return;
|
||||||
_CountFinalized++;
|
_CountDisposed++;
|
||||||
}
|
_Disposed = true;
|
||||||
public void Dispose()
|
RemoveFromCache(this);
|
||||||
{
|
if (!_CacheByPrimaryKey.ContainsKey(OwnerID.ToString())) return;
|
||||||
if (_Disposed) return;
|
List<OwnerInfo> listOwnerInfo = _CacheByPrimaryKey[OwnerID.ToString()]; // Get the list of items
|
||||||
_CountDisposed++;
|
while (listOwnerInfo.Contains(this)) listOwnerInfo.Remove(this); // Remove the item from the list
|
||||||
_Disposed = true;
|
if (listOwnerInfo.Count == 0) // If there are no items left in the list
|
||||||
RemoveFromCache(this);
|
_CacheByPrimaryKey.Remove(OwnerID.ToString()); // remove the list
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(OwnerID.ToString())) return;
|
}
|
||||||
List<OwnerInfo> listOwnerInfo = _CacheByPrimaryKey[OwnerID.ToString()]; // Get the list of items
|
public virtual Owner Get()
|
||||||
while (listOwnerInfo.Contains(this)) listOwnerInfo.Remove(this); // Remove the item from the list
|
{
|
||||||
if (listOwnerInfo.Count == 0) // If there are no items left in the list
|
return _Editable = Owner.Get(_OwnerID);
|
||||||
_CacheByPrimaryKey.Remove(OwnerID.ToString()); // remove the list
|
}
|
||||||
}
|
public static void Refresh(Owner tmp)
|
||||||
public virtual Owner Get()
|
{
|
||||||
{
|
string key = tmp.OwnerID.ToString();
|
||||||
return _Editable = Owner.Get(_OwnerID);
|
ConvertListToDictionary();
|
||||||
}
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
public static void Refresh(Owner tmp)
|
foreach (OwnerInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
{
|
tmpInfo.RefreshFields(tmp);
|
||||||
string key = tmp.OwnerID.ToString();
|
}
|
||||||
ConvertListToDictionary();
|
protected virtual void RefreshFields(Owner tmp)
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
{
|
||||||
foreach (OwnerInfo tmpInfo in _CacheByPrimaryKey[key])
|
_SessionID = tmp.SessionID;
|
||||||
tmpInfo.RefreshFields(tmp);
|
_OwnerType = tmp.OwnerType;
|
||||||
}
|
_OwnerItemID = tmp.OwnerItemID;
|
||||||
protected virtual void RefreshFields(Owner tmp)
|
_DTSStart = tmp.DTSStart;
|
||||||
{
|
_OwnerInfoExtension.Refresh(this);
|
||||||
_SessionID = tmp.SessionID;
|
OnChange();// raise an event
|
||||||
_OwnerType = tmp.OwnerType;
|
}
|
||||||
_OwnerItemID = tmp.OwnerItemID;
|
public static OwnerInfo Get(int ownerID)
|
||||||
_DTSStart = tmp.DTSStart;
|
{
|
||||||
_OwnerInfoExtension.Refresh(this);
|
//if (!CanGetObject())
|
||||||
OnChange();// raise an event
|
// throw new System.Security.SecurityException("User not authorized to view a Owner");
|
||||||
}
|
try
|
||||||
public static OwnerInfo Get(int ownerID)
|
{
|
||||||
{
|
OwnerInfo tmp = GetCachedByPrimaryKey(ownerID);
|
||||||
//if (!CanGetObject())
|
if (tmp == null)
|
||||||
// throw new System.Security.SecurityException("User not authorized to view a Owner");
|
{
|
||||||
try
|
tmp = DataPortal.Fetch<OwnerInfo>(new PKCriteria(ownerID));
|
||||||
{
|
AddToCache(tmp);
|
||||||
OwnerInfo tmp = GetCachedByPrimaryKey(ownerID);
|
}
|
||||||
if (tmp == null)
|
if (tmp.ErrorMessage == "No Record Found")
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<OwnerInfo>(new PKCriteria(ownerID));
|
tmp.Dispose(); // Clean-up OwnerInfo
|
||||||
AddToCache(tmp);
|
tmp = null;
|
||||||
}
|
}
|
||||||
if (tmp.ErrorMessage == "No Record Found")
|
return tmp;
|
||||||
{
|
}
|
||||||
tmp.Dispose(); // Clean-up OwnerInfo
|
catch (Exception ex)
|
||||||
tmp = null;
|
{
|
||||||
}
|
throw new DbCslaException("Error on OwnerInfo.Get", ex);
|
||||||
return tmp;
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
#endregion
|
||||||
{
|
#region Data Access Portal
|
||||||
throw new DbCslaException("Error on OwnerInfo.Get", ex);
|
internal OwnerInfo(SafeDataReader dr)
|
||||||
}
|
{
|
||||||
}
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] OwnerInfo.Constructor", GetHashCode());
|
||||||
#endregion
|
try
|
||||||
#region Data Access Portal
|
{
|
||||||
internal OwnerInfo(SafeDataReader dr)
|
ReadData(dr);
|
||||||
{
|
}
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] OwnerInfo.Constructor", GetHashCode());
|
catch (Exception ex)
|
||||||
try
|
{
|
||||||
{
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("OwnerInfo.Constructor", ex);
|
||||||
ReadData(dr);
|
throw new DbCslaException("OwnerInfo.Constructor", ex);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
}
|
||||||
{
|
[Serializable()]
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("OwnerInfo.Constructor", ex);
|
protected class PKCriteria
|
||||||
throw new DbCslaException("OwnerInfo.Constructor", ex);
|
{
|
||||||
}
|
private int _OwnerID;
|
||||||
}
|
public int OwnerID
|
||||||
[Serializable()]
|
{ get { return _OwnerID; } }
|
||||||
protected class PKCriteria
|
public PKCriteria(int ownerID)
|
||||||
{
|
{
|
||||||
private int _OwnerID;
|
_OwnerID = ownerID;
|
||||||
public int OwnerID
|
}
|
||||||
{ get { return _OwnerID; } }
|
}
|
||||||
public PKCriteria(int ownerID)
|
private void ReadData(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
_OwnerID = ownerID;
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] OwnerInfo.ReadData", GetHashCode());
|
||||||
}
|
try
|
||||||
}
|
{
|
||||||
private void ReadData(SafeDataReader dr)
|
_OwnerID = dr.GetInt32("OwnerID");
|
||||||
{
|
_SessionID = dr.GetInt32("SessionID");
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] OwnerInfo.ReadData", GetHashCode());
|
_OwnerType = dr.GetByte("OwnerType");
|
||||||
try
|
_OwnerItemID = dr.GetInt32("OwnerItemID");
|
||||||
{
|
_DTSStart = dr.GetDateTime("DTSStart");
|
||||||
_OwnerID = dr.GetInt32("OwnerID");
|
}
|
||||||
_SessionID = dr.GetInt32("SessionID");
|
catch (Exception ex)
|
||||||
_OwnerType = dr.GetByte("OwnerType");
|
{
|
||||||
_OwnerItemID = dr.GetInt32("OwnerItemID");
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("OwnerInfo.ReadData", ex);
|
||||||
_DTSStart = dr.GetDateTime("DTSStart");
|
_ErrorMessage = ex.Message;
|
||||||
}
|
throw new DbCslaException("OwnerInfo.ReadData", ex);
|
||||||
catch (Exception ex)
|
}
|
||||||
{
|
}
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("OwnerInfo.ReadData", ex);
|
private void DataPortal_Fetch(PKCriteria criteria)
|
||||||
_ErrorMessage = ex.Message;
|
{
|
||||||
throw new DbCslaException("OwnerInfo.ReadData", ex);
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] OwnerInfo.DataPortal_Fetch", GetHashCode());
|
||||||
}
|
try
|
||||||
}
|
{
|
||||||
private void DataPortal_Fetch(PKCriteria criteria)
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
{
|
{
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] OwnerInfo.DataPortal_Fetch", GetHashCode());
|
ApplicationContext.LocalContext["cn"] = cn;
|
||||||
try
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
{
|
{
|
||||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
{
|
cm.CommandTimeout = Database.SQLTimeout;
|
||||||
ApplicationContext.LocalContext["cn"] = cn;
|
cm.CommandText = "getOwner";
|
||||||
using (SqlCommand cm = cn.CreateCommand())
|
cm.Parameters.AddWithValue("@OwnerID", criteria.OwnerID);
|
||||||
{
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
cm.CommandType = CommandType.StoredProcedure;
|
{
|
||||||
cm.CommandTimeout = Database.SQLTimeout;
|
if (!dr.Read())
|
||||||
cm.CommandText = "getOwner";
|
{
|
||||||
cm.Parameters.AddWithValue("@OwnerID", criteria.OwnerID);
|
_ErrorMessage = "No Record Found";
|
||||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
return;
|
||||||
{
|
}
|
||||||
if (!dr.Read())
|
ReadData(dr);
|
||||||
{
|
}
|
||||||
_ErrorMessage = "No Record Found";
|
}
|
||||||
return;
|
// removing of item only needed for local data portal
|
||||||
}
|
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
||||||
ReadData(dr);
|
ApplicationContext.LocalContext.Remove("cn");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// removing of item only needed for local data portal
|
catch (Exception ex)
|
||||||
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
{
|
||||||
ApplicationContext.LocalContext.Remove("cn");
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("OwnerInfo.DataPortal_Fetch", ex);
|
||||||
}
|
_ErrorMessage = ex.Message;
|
||||||
}
|
throw new DbCslaException("OwnerInfo.DataPortal_Fetch", ex);
|
||||||
catch (Exception ex)
|
}
|
||||||
{
|
}
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("OwnerInfo.DataPortal_Fetch", ex);
|
#endregion
|
||||||
_ErrorMessage = ex.Message;
|
// Standard Refresh
|
||||||
throw new DbCslaException("OwnerInfo.DataPortal_Fetch", ex);
|
#region extension
|
||||||
}
|
OwnerInfoExtension _OwnerInfoExtension = new OwnerInfoExtension();
|
||||||
}
|
[Serializable()]
|
||||||
#endregion
|
partial class OwnerInfoExtension : extensionBase { }
|
||||||
// Standard Refresh
|
[Serializable()]
|
||||||
#region extension
|
class extensionBase
|
||||||
OwnerInfoExtension _OwnerInfoExtension = new OwnerInfoExtension();
|
{
|
||||||
[Serializable()]
|
// Default Refresh
|
||||||
partial class OwnerInfoExtension : extensionBase { }
|
public virtual void Refresh(OwnerInfo tmp) { }
|
||||||
[Serializable()]
|
}
|
||||||
class extensionBase
|
#endregion
|
||||||
{
|
} // Class
|
||||||
// Default Refresh
|
#region Converter
|
||||||
public virtual void Refresh(OwnerInfo tmp) { }
|
internal class OwnerInfoConverter : ExpandableObjectConverter
|
||||||
}
|
{
|
||||||
#endregion
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
} // Class
|
{
|
||||||
#region Converter
|
if (destType == typeof(string) && value is OwnerInfo)
|
||||||
internal class OwnerInfoConverter : ExpandableObjectConverter
|
{
|
||||||
{
|
// Return the ToString value
|
||||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
return ((OwnerInfo)value).ToString();
|
||||||
{
|
}
|
||||||
if (destType == typeof(string) && value is OwnerInfo)
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
{
|
}
|
||||||
// Return the ToString value
|
}
|
||||||
return ((OwnerInfo)value).ToString();
|
#endregion
|
||||||
}
|
|
||||||
return base.ConvertTo(context, culture, value, destType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -19,361 +19,354 @@ using System.ComponentModel;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
public delegate void PartAuditInfoEvent(object sender);
|
public delegate void PartAuditInfoEvent(object sender);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// PartAuditInfo Generated by MyGeneration using the CSLA Object Mapping template
|
/// PartAuditInfo Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
[TypeConverter(typeof(PartAuditInfoConverter))]
|
[TypeConverter(typeof(PartAuditInfoConverter))]
|
||||||
public partial class PartAuditInfo : ReadOnlyBase<PartAuditInfo>, IDisposable
|
public partial class PartAuditInfo : ReadOnlyBase<PartAuditInfo>, IDisposable
|
||||||
{
|
{
|
||||||
public event PartAuditInfoEvent Changed;
|
public event PartAuditInfoEvent Changed;
|
||||||
private void OnChange()
|
private void OnChange()
|
||||||
{
|
{
|
||||||
if (Changed != null) Changed(this);
|
if (Changed != null) Changed(this);
|
||||||
}
|
}
|
||||||
#region Log4Net
|
#region Log4Net
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
private static List<PartAuditInfo> _CacheList = new List<PartAuditInfo>();
|
private static List<PartAuditInfo> _CacheList = new List<PartAuditInfo>();
|
||||||
protected static void AddToCache(PartAuditInfo partAuditInfo)
|
protected static void AddToCache(PartAuditInfo partAuditInfo)
|
||||||
{
|
{
|
||||||
if (!_CacheList.Contains(partAuditInfo)) _CacheList.Add(partAuditInfo); // In AddToCache
|
if (!_CacheList.Contains(partAuditInfo)) _CacheList.Add(partAuditInfo); // In AddToCache
|
||||||
}
|
}
|
||||||
protected static void RemoveFromCache(PartAuditInfo partAuditInfo)
|
protected static void RemoveFromCache(PartAuditInfo partAuditInfo)
|
||||||
{
|
{
|
||||||
while (_CacheList.Contains(partAuditInfo)) _CacheList.Remove(partAuditInfo); // In RemoveFromCache
|
while (_CacheList.Contains(partAuditInfo)) _CacheList.Remove(partAuditInfo); // In RemoveFromCache
|
||||||
}
|
}
|
||||||
private static Dictionary<string, List<PartAuditInfo>> _CacheByPrimaryKey = new Dictionary<string, List<PartAuditInfo>>();
|
private static Dictionary<string, List<PartAuditInfo>> _CacheByPrimaryKey = new Dictionary<string, List<PartAuditInfo>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
while (_CacheList.Count > 0) // Move PartAuditInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
while (_CacheList.Count > 0) // Move PartAuditInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
||||||
{
|
{
|
||||||
PartAuditInfo tmp = _CacheList[0]; // Get the first PartAuditInfo
|
PartAuditInfo tmp = _CacheList[0]; // Get the first PartAuditInfo
|
||||||
string pKey = tmp.AuditID.ToString();
|
string pKey = tmp.AuditID.ToString();
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
||||||
{
|
{
|
||||||
_CacheByPrimaryKey[pKey] = new List<PartAuditInfo>(); // Add new list for PrimaryKey
|
_CacheByPrimaryKey[pKey] = new List<PartAuditInfo>(); // Add new list for PrimaryKey
|
||||||
}
|
}
|
||||||
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
||||||
_CacheList.RemoveAt(0); // Remove the first PartAuditInfo
|
_CacheList.RemoveAt(0); // Remove the first PartAuditInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
internal static void AddList(PartAuditInfoList lst)
|
internal static void AddList(PartAuditInfoList lst)
|
||||||
{
|
{
|
||||||
foreach (PartAuditInfo item in lst) AddToCache(item);
|
foreach (PartAuditInfo item in lst) AddToCache(item);
|
||||||
}
|
}
|
||||||
protected static PartAuditInfo GetCachedByPrimaryKey(long auditID)
|
protected static PartAuditInfo GetCachedByPrimaryKey(long auditID)
|
||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = auditID.ToString();
|
string key = auditID.ToString();
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Business Methods
|
#region Business Methods
|
||||||
private string _ErrorMessage = string.Empty;
|
private string _ErrorMessage = string.Empty;
|
||||||
public string ErrorMessage
|
public string ErrorMessage
|
||||||
{
|
{
|
||||||
get { return _ErrorMessage; }
|
get { return _ErrorMessage; }
|
||||||
}
|
}
|
||||||
protected PartAudit _Editable;
|
protected PartAudit _Editable;
|
||||||
private IVEHasBrokenRules HasBrokenRules
|
private IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
IVEHasBrokenRules hasBrokenRules = null;
|
IVEHasBrokenRules hasBrokenRules = null;
|
||||||
if (_Editable != null)
|
if (_Editable != null)
|
||||||
hasBrokenRules = _Editable.HasBrokenRules;
|
hasBrokenRules = _Editable.HasBrokenRules;
|
||||||
return hasBrokenRules;
|
return hasBrokenRules;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private long _AuditID;
|
private long _AuditID;
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
public long AuditID
|
public long AuditID
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("AuditID", true);
|
return _AuditID;
|
||||||
return _AuditID;
|
}
|
||||||
}
|
}
|
||||||
}
|
private int _ContentID;
|
||||||
private int _ContentID;
|
public int ContentID
|
||||||
public int ContentID
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
get
|
||||||
get
|
{
|
||||||
{
|
return _ContentID;
|
||||||
CanReadProperty("ContentID", true);
|
}
|
||||||
return _ContentID;
|
}
|
||||||
}
|
private int _FromType;
|
||||||
}
|
public int FromType
|
||||||
private int _FromType;
|
{
|
||||||
public int FromType
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
return _FromType;
|
||||||
{
|
}
|
||||||
CanReadProperty("FromType", true);
|
}
|
||||||
return _FromType;
|
private int _ItemID;
|
||||||
}
|
public int ItemID
|
||||||
}
|
{
|
||||||
private int _ItemID;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
public int ItemID
|
get
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
return _ItemID;
|
||||||
get
|
}
|
||||||
{
|
}
|
||||||
CanReadProperty("ItemID", true);
|
private DateTime _DTS = new DateTime();
|
||||||
return _ItemID;
|
public DateTime DTS
|
||||||
}
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
private DateTime _DTS = new DateTime();
|
get
|
||||||
public DateTime DTS
|
{
|
||||||
{
|
return _DTS;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
}
|
||||||
{
|
private string _UserID = string.Empty;
|
||||||
CanReadProperty("DTS", true);
|
public string UserID
|
||||||
return _DTS;
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
private string _UserID = string.Empty;
|
{
|
||||||
public string UserID
|
return _UserID;
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
private int _DeleteStatus;
|
||||||
{
|
public int DeleteStatus
|
||||||
CanReadProperty("UserID", true);
|
{
|
||||||
return _UserID;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
}
|
{
|
||||||
private int _DeleteStatus;
|
return _DeleteStatus;
|
||||||
public int DeleteStatus
|
}
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
// CSLATODO: Replace base PartAuditInfo.ToString function as necessary
|
||||||
get
|
/// <summary>
|
||||||
{
|
/// Overrides Base ToString
|
||||||
CanReadProperty("DeleteStatus", true);
|
/// </summary>
|
||||||
return _DeleteStatus;
|
/// <returns>A string representation of current PartAuditInfo</returns>
|
||||||
}
|
//public override string ToString()
|
||||||
}
|
//{
|
||||||
// CSLATODO: Replace base PartAuditInfo.ToString function as necessary
|
// return base.ToString();
|
||||||
/// <summary>
|
//}
|
||||||
/// Overrides Base ToString
|
// CSLATODO: Check PartAuditInfo.GetIdValue to assure that the ID returned is unique
|
||||||
/// </summary>
|
/// <summary>
|
||||||
/// <returns>A string representation of current PartAuditInfo</returns>
|
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||||
//public override string ToString()
|
/// </summary>
|
||||||
//{
|
/// <returns>A Unique ID for the current PartAuditInfo</returns>
|
||||||
// return base.ToString();
|
protected override object GetIdValue()
|
||||||
//}
|
{
|
||||||
// CSLATODO: Check PartAuditInfo.GetIdValue to assure that the ID returned is unique
|
return MyPartAuditInfoUnique; // Absolutely Unique ID
|
||||||
/// <summary>
|
}
|
||||||
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
#endregion
|
||||||
/// </summary>
|
#region Factory Methods
|
||||||
/// <returns>A Unique ID for the current PartAuditInfo</returns>
|
private static int _PartAuditInfoUnique = 0;
|
||||||
protected override object GetIdValue()
|
private static int PartAuditInfoUnique
|
||||||
{
|
{ get { return ++_PartAuditInfoUnique; } }
|
||||||
return MyPartAuditInfoUnique; // Absolutely Unique ID
|
private int _MyPartAuditInfoUnique = PartAuditInfoUnique;
|
||||||
}
|
public int MyPartAuditInfoUnique // Absolutely Unique ID - Info
|
||||||
#endregion
|
{ get { return _MyPartAuditInfoUnique; } }
|
||||||
#region Factory Methods
|
protected PartAuditInfo()
|
||||||
private static int _PartAuditInfoUnique = 0;
|
{/* require use of factory methods */
|
||||||
private static int PartAuditInfoUnique
|
AddToCache(this);
|
||||||
{ get { return ++_PartAuditInfoUnique; } }
|
}
|
||||||
private int _MyPartAuditInfoUnique = PartAuditInfoUnique;
|
private bool _Disposed = false;
|
||||||
public int MyPartAuditInfoUnique // Absolutely Unique ID - Info
|
private static int _CountCreated = 0;
|
||||||
{ get { return _MyPartAuditInfoUnique; } }
|
private static int _CountDisposed = 0;
|
||||||
protected PartAuditInfo()
|
private static int _CountFinalized = 0;
|
||||||
{/* require use of factory methods */
|
private static int IncrementCountCreated
|
||||||
AddToCache(this);
|
{ get { return ++_CountCreated; } }
|
||||||
}
|
private int _CountWhenCreated = IncrementCountCreated;
|
||||||
private bool _Disposed = false;
|
public static int CountCreated
|
||||||
private static int _CountCreated = 0;
|
{ get { return _CountCreated; } }
|
||||||
private static int _CountDisposed = 0;
|
public static int CountNotDisposed
|
||||||
private static int _CountFinalized = 0;
|
{ get { return _CountCreated - _CountDisposed; } }
|
||||||
private static int IncrementCountCreated
|
public static int CountNotFinalized
|
||||||
{ get { return ++_CountCreated; } }
|
{ get { return _CountCreated - _CountFinalized; } }
|
||||||
private int _CountWhenCreated = IncrementCountCreated;
|
~PartAuditInfo()
|
||||||
public static int CountCreated
|
{
|
||||||
{ get { return _CountCreated; } }
|
_CountFinalized++;
|
||||||
public static int CountNotDisposed
|
}
|
||||||
{ get { return _CountCreated - _CountDisposed; } }
|
public void Dispose()
|
||||||
public static int CountNotFinalized
|
{
|
||||||
{ get { return _CountCreated - _CountFinalized; } }
|
if (_Disposed) return;
|
||||||
~PartAuditInfo()
|
_CountDisposed++;
|
||||||
{
|
_Disposed = true;
|
||||||
_CountFinalized++;
|
RemoveFromCache(this);
|
||||||
}
|
if (!_CacheByPrimaryKey.ContainsKey(AuditID.ToString())) return;
|
||||||
public void Dispose()
|
List<PartAuditInfo> listPartAuditInfo = _CacheByPrimaryKey[AuditID.ToString()]; // Get the list of items
|
||||||
{
|
while (listPartAuditInfo.Contains(this)) listPartAuditInfo.Remove(this); // Remove the item from the list
|
||||||
if (_Disposed) return;
|
if (listPartAuditInfo.Count == 0) // If there are no items left in the list
|
||||||
_CountDisposed++;
|
_CacheByPrimaryKey.Remove(AuditID.ToString()); // remove the list
|
||||||
_Disposed = true;
|
}
|
||||||
RemoveFromCache(this);
|
public virtual PartAudit Get()
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(AuditID.ToString())) return;
|
{
|
||||||
List<PartAuditInfo> listPartAuditInfo = _CacheByPrimaryKey[AuditID.ToString()]; // Get the list of items
|
return _Editable = PartAudit.Get(_AuditID);
|
||||||
while (listPartAuditInfo.Contains(this)) listPartAuditInfo.Remove(this); // Remove the item from the list
|
}
|
||||||
if (listPartAuditInfo.Count == 0) // If there are no items left in the list
|
public static void Refresh(PartAudit tmp)
|
||||||
_CacheByPrimaryKey.Remove(AuditID.ToString()); // remove the list
|
{
|
||||||
}
|
string key = tmp.AuditID.ToString();
|
||||||
public virtual PartAudit Get()
|
ConvertListToDictionary();
|
||||||
{
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
return _Editable = PartAudit.Get(_AuditID);
|
foreach (PartAuditInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
}
|
tmpInfo.RefreshFields(tmp);
|
||||||
public static void Refresh(PartAudit tmp)
|
}
|
||||||
{
|
protected virtual void RefreshFields(PartAudit tmp)
|
||||||
string key = tmp.AuditID.ToString();
|
{
|
||||||
ConvertListToDictionary();
|
_ContentID = tmp.ContentID;
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
_FromType = tmp.FromType;
|
||||||
foreach (PartAuditInfo tmpInfo in _CacheByPrimaryKey[key])
|
_ItemID = tmp.ItemID;
|
||||||
tmpInfo.RefreshFields(tmp);
|
_DTS = tmp.DTS;
|
||||||
}
|
_UserID = tmp.UserID;
|
||||||
protected virtual void RefreshFields(PartAudit tmp)
|
_DeleteStatus = tmp.DeleteStatus;
|
||||||
{
|
_PartAuditInfoExtension.Refresh(this);
|
||||||
_ContentID = tmp.ContentID;
|
OnChange();// raise an event
|
||||||
_FromType = tmp.FromType;
|
}
|
||||||
_ItemID = tmp.ItemID;
|
public static PartAuditInfo Get(long auditID)
|
||||||
_DTS = tmp.DTS;
|
{
|
||||||
_UserID = tmp.UserID;
|
//if (!CanGetObject())
|
||||||
_DeleteStatus = tmp.DeleteStatus;
|
// throw new System.Security.SecurityException("User not authorized to view a PartAudit");
|
||||||
_PartAuditInfoExtension.Refresh(this);
|
try
|
||||||
OnChange();// raise an event
|
{
|
||||||
}
|
PartAuditInfo tmp = GetCachedByPrimaryKey(auditID);
|
||||||
public static PartAuditInfo Get(long auditID)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
//if (!CanGetObject())
|
tmp = DataPortal.Fetch<PartAuditInfo>(new PKCriteria(auditID));
|
||||||
// throw new System.Security.SecurityException("User not authorized to view a PartAudit");
|
AddToCache(tmp);
|
||||||
try
|
}
|
||||||
{
|
if (tmp.ErrorMessage == "No Record Found")
|
||||||
PartAuditInfo tmp = GetCachedByPrimaryKey(auditID);
|
{
|
||||||
if (tmp == null)
|
tmp.Dispose(); // Clean-up PartAuditInfo
|
||||||
{
|
tmp = null;
|
||||||
tmp = DataPortal.Fetch<PartAuditInfo>(new PKCriteria(auditID));
|
}
|
||||||
AddToCache(tmp);
|
return tmp;
|
||||||
}
|
}
|
||||||
if (tmp.ErrorMessage == "No Record Found")
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
tmp.Dispose(); // Clean-up PartAuditInfo
|
throw new DbCslaException("Error on PartAuditInfo.Get", ex);
|
||||||
tmp = null;
|
}
|
||||||
}
|
}
|
||||||
return tmp;
|
#endregion
|
||||||
}
|
#region Data Access Portal
|
||||||
catch (Exception ex)
|
internal PartAuditInfo(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
throw new DbCslaException("Error on PartAuditInfo.Get", ex);
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PartAuditInfo.Constructor", GetHashCode());
|
||||||
}
|
try
|
||||||
}
|
{
|
||||||
#endregion
|
ReadData(dr);
|
||||||
#region Data Access Portal
|
}
|
||||||
internal PartAuditInfo(SafeDataReader dr)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PartAuditInfo.Constructor", GetHashCode());
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("PartAuditInfo.Constructor", ex);
|
||||||
try
|
throw new DbCslaException("PartAuditInfo.Constructor", ex);
|
||||||
{
|
}
|
||||||
ReadData(dr);
|
}
|
||||||
}
|
[Serializable()]
|
||||||
catch (Exception ex)
|
protected class PKCriteria
|
||||||
{
|
{
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("PartAuditInfo.Constructor", ex);
|
private long _AuditID;
|
||||||
throw new DbCslaException("PartAuditInfo.Constructor", ex);
|
public long AuditID
|
||||||
}
|
{ get { return _AuditID; } }
|
||||||
}
|
public PKCriteria(long auditID)
|
||||||
[Serializable()]
|
{
|
||||||
protected class PKCriteria
|
_AuditID = auditID;
|
||||||
{
|
}
|
||||||
private long _AuditID;
|
}
|
||||||
public long AuditID
|
private void ReadData(SafeDataReader dr)
|
||||||
{ get { return _AuditID; } }
|
{
|
||||||
public PKCriteria(long auditID)
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PartAuditInfo.ReadData", GetHashCode());
|
||||||
{
|
try
|
||||||
_AuditID = auditID;
|
{
|
||||||
}
|
_AuditID = dr.GetInt64("AuditID");
|
||||||
}
|
_ContentID = dr.GetInt32("ContentID");
|
||||||
private void ReadData(SafeDataReader dr)
|
_FromType = dr.GetInt32("FromType");
|
||||||
{
|
_ItemID = dr.GetInt32("ItemID");
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PartAuditInfo.ReadData", GetHashCode());
|
_DTS = dr.GetDateTime("DTS");
|
||||||
try
|
_UserID = dr.GetString("UserID");
|
||||||
{
|
_DeleteStatus = dr.GetInt32("DeleteStatus");
|
||||||
_AuditID = dr.GetInt64("AuditID");
|
}
|
||||||
_ContentID = dr.GetInt32("ContentID");
|
catch (Exception ex)
|
||||||
_FromType = dr.GetInt32("FromType");
|
{
|
||||||
_ItemID = dr.GetInt32("ItemID");
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("PartAuditInfo.ReadData", ex);
|
||||||
_DTS = dr.GetDateTime("DTS");
|
_ErrorMessage = ex.Message;
|
||||||
_UserID = dr.GetString("UserID");
|
throw new DbCslaException("PartAuditInfo.ReadData", ex);
|
||||||
_DeleteStatus = dr.GetInt32("DeleteStatus");
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
private void DataPortal_Fetch(PKCriteria criteria)
|
||||||
{
|
{
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("PartAuditInfo.ReadData", ex);
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PartAuditInfo.DataPortal_Fetch", GetHashCode());
|
||||||
_ErrorMessage = ex.Message;
|
try
|
||||||
throw new DbCslaException("PartAuditInfo.ReadData", ex);
|
{
|
||||||
}
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
}
|
{
|
||||||
private void DataPortal_Fetch(PKCriteria criteria)
|
ApplicationContext.LocalContext["cn"] = cn;
|
||||||
{
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PartAuditInfo.DataPortal_Fetch", GetHashCode());
|
{
|
||||||
try
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
{
|
cm.CommandText = "getPartAudit";
|
||||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
cm.Parameters.AddWithValue("@AuditID", criteria.AuditID);
|
||||||
{
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
ApplicationContext.LocalContext["cn"] = cn;
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
using (SqlCommand cm = cn.CreateCommand())
|
{
|
||||||
{
|
if (!dr.Read())
|
||||||
cm.CommandType = CommandType.StoredProcedure;
|
{
|
||||||
cm.CommandText = "getPartAudit";
|
_ErrorMessage = "No Record Found";
|
||||||
cm.Parameters.AddWithValue("@AuditID", criteria.AuditID);
|
return;
|
||||||
cm.CommandTimeout = Database.DefaultTimeout;
|
}
|
||||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
ReadData(dr);
|
||||||
{
|
}
|
||||||
if (!dr.Read())
|
}
|
||||||
{
|
// removing of item only needed for local data portal
|
||||||
_ErrorMessage = "No Record Found";
|
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
||||||
return;
|
ApplicationContext.LocalContext.Remove("cn");
|
||||||
}
|
}
|
||||||
ReadData(dr);
|
}
|
||||||
}
|
catch (Exception ex)
|
||||||
}
|
{
|
||||||
// removing of item only needed for local data portal
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("PartAuditInfo.DataPortal_Fetch", ex);
|
||||||
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
_ErrorMessage = ex.Message;
|
||||||
ApplicationContext.LocalContext.Remove("cn");
|
throw new DbCslaException("PartAuditInfo.DataPortal_Fetch", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
#endregion
|
||||||
{
|
// Standard Refresh
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("PartAuditInfo.DataPortal_Fetch", ex);
|
#region extension
|
||||||
_ErrorMessage = ex.Message;
|
PartAuditInfoExtension _PartAuditInfoExtension = new PartAuditInfoExtension();
|
||||||
throw new DbCslaException("PartAuditInfo.DataPortal_Fetch", ex);
|
[Serializable()]
|
||||||
}
|
partial class PartAuditInfoExtension : extensionBase { }
|
||||||
}
|
[Serializable()]
|
||||||
#endregion
|
class extensionBase
|
||||||
// Standard Refresh
|
{
|
||||||
#region extension
|
// Default Refresh
|
||||||
PartAuditInfoExtension _PartAuditInfoExtension = new PartAuditInfoExtension();
|
public virtual void Refresh(PartAuditInfo tmp) { }
|
||||||
[Serializable()]
|
}
|
||||||
partial class PartAuditInfoExtension : extensionBase { }
|
#endregion
|
||||||
[Serializable()]
|
} // Class
|
||||||
class extensionBase
|
#region Converter
|
||||||
{
|
internal class PartAuditInfoConverter : ExpandableObjectConverter
|
||||||
// Default Refresh
|
{
|
||||||
public virtual void Refresh(PartAuditInfo tmp) { }
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
}
|
{
|
||||||
#endregion
|
if (destType == typeof(string) && value is PartAuditInfo)
|
||||||
} // Class
|
{
|
||||||
#region Converter
|
// Return the ToString value
|
||||||
internal class PartAuditInfoConverter : ExpandableObjectConverter
|
return ((PartAuditInfo)value).ToString();
|
||||||
{
|
}
|
||||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
{
|
}
|
||||||
if (destType == typeof(string) && value is PartAuditInfo)
|
}
|
||||||
{
|
#endregion
|
||||||
// Return the ToString value
|
|
||||||
return ((PartAuditInfo)value).ToString();
|
|
||||||
}
|
|
||||||
return base.ConvertTo(context, culture, value, destType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
@ -19,410 +19,412 @@ using System.ComponentModel;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
public delegate void PartInfoEvent(object sender);
|
public delegate void PartInfoEvent(object sender);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// PartInfo Generated by MyGeneration using the CSLA Object Mapping template
|
/// PartInfo Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
[TypeConverter(typeof(PartInfoConverter))]
|
[TypeConverter(typeof(PartInfoConverter))]
|
||||||
public partial class PartInfo : ReadOnlyBase<PartInfo>, IDisposable
|
public partial class PartInfo : ReadOnlyBase<PartInfo>, IDisposable
|
||||||
{
|
{
|
||||||
public event PartInfoEvent Changed;
|
public event PartInfoEvent Changed;
|
||||||
private void OnChange()
|
private void OnChange()
|
||||||
{
|
{
|
||||||
if (Changed != null) Changed(this);
|
if (Changed != null) Changed(this);
|
||||||
}
|
}
|
||||||
#region Log4Net
|
#region Log4Net
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
private static List<PartInfo> _CacheList = new List<PartInfo>();
|
private static List<PartInfo> _CacheList = new List<PartInfo>();
|
||||||
protected static void AddToCache(PartInfo partInfo)
|
protected static void AddToCache(PartInfo partInfo)
|
||||||
{
|
{
|
||||||
if (!_CacheList.Contains(partInfo)) _CacheList.Add(partInfo); // In AddToCache
|
if (!_CacheList.Contains(partInfo)) _CacheList.Add(partInfo); // In AddToCache
|
||||||
}
|
}
|
||||||
protected static void RemoveFromCache(PartInfo partInfo)
|
protected static void RemoveFromCache(PartInfo partInfo)
|
||||||
{
|
{
|
||||||
while (_CacheList.Contains(partInfo)) _CacheList.Remove(partInfo); // In RemoveFromCache
|
while (_CacheList.Contains(partInfo)) _CacheList.Remove(partInfo); // In RemoveFromCache
|
||||||
}
|
}
|
||||||
private static Dictionary<string, List<PartInfo>> _CacheByPrimaryKey = new Dictionary<string, List<PartInfo>>();
|
private static Dictionary<string, List<PartInfo>> _CacheByPrimaryKey = new Dictionary<string, List<PartInfo>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
while (_CacheList.Count > 0) // Move PartInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
while (_CacheList.Count > 0) // Move PartInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
||||||
{
|
{
|
||||||
PartInfo tmp = _CacheList[0]; // Get the first PartInfo
|
PartInfo tmp = _CacheList[0]; // Get the first PartInfo
|
||||||
string pKey = tmp.ContentID.ToString() + "_" + tmp.FromType.ToString();
|
string pKey = tmp.ContentID.ToString() + "_" + tmp.FromType.ToString();
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
||||||
{
|
{
|
||||||
_CacheByPrimaryKey[pKey] = new List<PartInfo>(); // Add new list for PrimaryKey
|
_CacheByPrimaryKey[pKey] = new List<PartInfo>(); // Add new list for PrimaryKey
|
||||||
}
|
}
|
||||||
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
||||||
_CacheList.RemoveAt(0); // Remove the first PartInfo
|
_CacheList.RemoveAt(0); // Remove the first PartInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
internal static void AddList(PartInfoList lst)
|
internal static void AddList(PartInfoList lst)
|
||||||
{
|
{
|
||||||
foreach (PartInfo item in lst) AddToCache(item);
|
foreach (PartInfo item in lst) AddToCache(item);
|
||||||
}
|
}
|
||||||
protected static PartInfo GetCachedByPrimaryKey(int contentID, int fromType)
|
protected static PartInfo GetCachedByPrimaryKey(int contentID, int fromType)
|
||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = contentID.ToString() + "_" + fromType.ToString();
|
string key = contentID.ToString() + "_" + fromType.ToString();
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
public static void ClearPartInfoCache()
|
||||||
#region Business Methods
|
{
|
||||||
private string _ErrorMessage = string.Empty;
|
_CacheByPrimaryKey.Clear();
|
||||||
public string ErrorMessage
|
while (_CacheList.Count > 0)
|
||||||
{
|
{ _CacheList[0].Dispose(); }
|
||||||
get { return _ErrorMessage; }
|
|
||||||
}
|
}
|
||||||
protected Part _Editable;
|
#endregion
|
||||||
private IVEHasBrokenRules HasBrokenRules
|
#region Business Methods
|
||||||
{
|
private string _ErrorMessage = string.Empty;
|
||||||
get
|
public string ErrorMessage
|
||||||
{
|
{
|
||||||
IVEHasBrokenRules hasBrokenRules = null;
|
get { return _ErrorMessage; }
|
||||||
if (_Editable != null)
|
}
|
||||||
hasBrokenRules = _Editable.HasBrokenRules;
|
protected Part _Editable;
|
||||||
return hasBrokenRules;
|
private IVEHasBrokenRules HasBrokenRules
|
||||||
}
|
{
|
||||||
}
|
get
|
||||||
private int _ContentID;
|
{
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
IVEHasBrokenRules hasBrokenRules = null;
|
||||||
public int ContentID
|
if (_Editable != null)
|
||||||
{
|
hasBrokenRules = _Editable.HasBrokenRules;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
return hasBrokenRules;
|
||||||
get
|
}
|
||||||
{
|
}
|
||||||
CanReadProperty("ContentID", true);
|
private int _ContentID;
|
||||||
if (_MyContent != null) _ContentID = _MyContent.ContentID;
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
return _ContentID;
|
public int ContentID
|
||||||
}
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
private ContentInfo _MyContent;
|
get
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
{
|
||||||
public ContentInfo MyContent
|
if (_MyContent != null) _ContentID = _MyContent.ContentID;
|
||||||
{
|
return _ContentID;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
}
|
||||||
{
|
private ContentInfo _MyContent;
|
||||||
CanReadProperty("MyContent", true);
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
if (_MyContent == null && _ContentID != 0) _MyContent = ContentInfo.Get(_ContentID);
|
public ContentInfo MyContent
|
||||||
return _MyContent;
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
private int _FromType;
|
{
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
if (_MyContent == null && _ContentID != 0) _MyContent = ContentInfo.Get(_ContentID);
|
||||||
public int FromType
|
return _MyContent;
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
private int _FromType;
|
||||||
{
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
CanReadProperty("FromType", true);
|
public int FromType
|
||||||
return _FromType;
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
private int _ItemID;
|
{
|
||||||
public int ItemID
|
return _FromType;
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
private int _ItemID;
|
||||||
{
|
public int ItemID
|
||||||
CanReadProperty("ItemID", true);
|
{
|
||||||
if (_MyItem != null) _ItemID = _MyItem.ItemID;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
return _ItemID;
|
get
|
||||||
}
|
{
|
||||||
}
|
if (_MyItem != null) _ItemID = _MyItem.ItemID;
|
||||||
private ItemInfo _MyItem;
|
return _ItemID;
|
||||||
public ItemInfo MyItem
|
}
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
private ItemInfo _MyItem;
|
||||||
get
|
public ItemInfo MyItem
|
||||||
{
|
{
|
||||||
CanReadProperty("MyItem", true);
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
if (_MyItem == null && _ItemID != 0) _MyItem = ItemInfo.Get(_ItemID);
|
get
|
||||||
return _MyItem;
|
{
|
||||||
}
|
if (_MyItem == null && _ItemID != 0) _MyItem = ItemInfo.Get(_ItemID);
|
||||||
}
|
return _MyItem;
|
||||||
private DateTime _DTS = new DateTime();
|
}
|
||||||
public DateTime DTS
|
}
|
||||||
{
|
private DateTime _DTS = new DateTime();
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
public DateTime DTS
|
||||||
get
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
CanReadProperty("DTS", true);
|
get
|
||||||
return _DTS;
|
{
|
||||||
}
|
return _DTS;
|
||||||
}
|
}
|
||||||
private string _UserID = string.Empty;
|
}
|
||||||
public string UserID
|
private string _UserID = string.Empty;
|
||||||
{
|
public string UserID
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
CanReadProperty("UserID", true);
|
{
|
||||||
return _UserID;
|
return _UserID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// CSLATODO: Replace base PartInfo.ToString function as necessary
|
// CSLATODO: Replace base PartInfo.ToString function as necessary
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Overrides Base ToString
|
/// Overrides Base ToString
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>A string representation of current PartInfo</returns>
|
/// <returns>A string representation of current PartInfo</returns>
|
||||||
//public override string ToString()
|
//public override string ToString()
|
||||||
//{
|
//{
|
||||||
// return base.ToString();
|
// return base.ToString();
|
||||||
//}
|
//}
|
||||||
// CSLATODO: Check PartInfo.GetIdValue to assure that the ID returned is unique
|
// CSLATODO: Check PartInfo.GetIdValue to assure that the ID returned is unique
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>A Unique ID for the current PartInfo</returns>
|
/// <returns>A Unique ID for the current PartInfo</returns>
|
||||||
protected override object GetIdValue()
|
protected override object GetIdValue()
|
||||||
{
|
{
|
||||||
return MyPartInfoUnique; // Absolutely Unique ID
|
return MyPartInfoUnique; // Absolutely Unique ID
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
private static int _PartInfoUnique = 0;
|
private static int _PartInfoUnique = 0;
|
||||||
private static int PartInfoUnique
|
private static int PartInfoUnique
|
||||||
{ get { return ++_PartInfoUnique; } }
|
{ get { return ++_PartInfoUnique; } }
|
||||||
private int _MyPartInfoUnique = PartInfoUnique;
|
private int _MyPartInfoUnique = PartInfoUnique;
|
||||||
public int MyPartInfoUnique // Absolutely Unique ID - Info
|
public int MyPartInfoUnique // Absolutely Unique ID - Info
|
||||||
{ get { return _MyPartInfoUnique; } }
|
{ get { return _MyPartInfoUnique; } }
|
||||||
protected PartInfo()
|
protected PartInfo()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
AddToCache(this);
|
AddToCache(this);
|
||||||
}
|
}
|
||||||
private bool _Disposed = false;
|
private bool _Disposed = false;
|
||||||
private static int _CountCreated = 0;
|
private static int _CountCreated = 0;
|
||||||
private static int _CountDisposed = 0;
|
private static int _CountDisposed = 0;
|
||||||
private static int _CountFinalized = 0;
|
private static int _CountFinalized = 0;
|
||||||
private static int IncrementCountCreated
|
private static int IncrementCountCreated
|
||||||
{ get { return ++_CountCreated; } }
|
{ get { return ++_CountCreated; } }
|
||||||
private int _CountWhenCreated = IncrementCountCreated;
|
private int _CountWhenCreated = IncrementCountCreated;
|
||||||
public static int CountCreated
|
public static int CountCreated
|
||||||
{ get { return _CountCreated; } }
|
{ get { return _CountCreated; } }
|
||||||
public static int CountNotDisposed
|
public static int CountNotDisposed
|
||||||
{ get { return _CountCreated - _CountDisposed; } }
|
{ get { return _CountCreated - _CountDisposed; } }
|
||||||
public static int CountNotFinalized
|
public static int CountNotFinalized
|
||||||
{ get { return _CountCreated - _CountFinalized; } }
|
{ get { return _CountCreated - _CountFinalized; } }
|
||||||
~PartInfo()
|
~PartInfo()
|
||||||
{
|
{
|
||||||
_CountFinalized++;
|
_CountFinalized++;
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
if (_Disposed) return;
|
if (_Disposed) return;
|
||||||
_CountDisposed++;
|
_CountDisposed++;
|
||||||
_Disposed = true;
|
_Disposed = true;
|
||||||
RemoveFromCache(this);
|
Changed = null;
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(ContentID.ToString() + "_" + FromType.ToString())) return;
|
_MyItems?.Dispose();
|
||||||
List<PartInfo> listPartInfo = _CacheByPrimaryKey[ContentID.ToString() + "_" + FromType.ToString()]; // Get the list of items
|
RemoveFromCache(this);
|
||||||
while (listPartInfo.Contains(this)) listPartInfo.Remove(this); // Remove the item from the list
|
if (!_CacheByPrimaryKey.ContainsKey(ContentID.ToString() + "_" + FromType.ToString())) return;
|
||||||
if (listPartInfo.Count == 0) // If there are no items left in the list
|
List<PartInfo> listPartInfo = _CacheByPrimaryKey[ContentID.ToString() + "_" + FromType.ToString()]; // Get the list of items
|
||||||
_CacheByPrimaryKey.Remove(ContentID.ToString() + "_" + FromType.ToString()); // remove the list
|
while (listPartInfo.Contains(this)) listPartInfo.Remove(this); // Remove the item from the list
|
||||||
}
|
if (listPartInfo.Count == 0) // If there are no items left in the list
|
||||||
public virtual Part Get()
|
_CacheByPrimaryKey.Remove(ContentID.ToString() + "_" + FromType.ToString()); // remove the list
|
||||||
{
|
}
|
||||||
return _Editable = Part.Get(_ContentID, _FromType);
|
public virtual Part Get()
|
||||||
}
|
{
|
||||||
public static void Refresh(Part tmp)
|
return _Editable = Part.Get(_ContentID, _FromType);
|
||||||
{
|
}
|
||||||
string key = tmp.ContentID.ToString() + "_" + tmp.FromType.ToString();
|
public static void Refresh(Part tmp)
|
||||||
ConvertListToDictionary();
|
{
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
string key = tmp.ContentID.ToString() + "_" + tmp.FromType.ToString();
|
||||||
foreach (PartInfo tmpInfo in _CacheByPrimaryKey[key])
|
ConvertListToDictionary();
|
||||||
tmpInfo.RefreshFields(tmp);
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
}
|
foreach (PartInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
protected virtual void RefreshFields(Part tmp)
|
tmpInfo.RefreshFields(tmp);
|
||||||
{
|
}
|
||||||
if (_ItemID != tmp.ItemID)
|
protected virtual void RefreshFields(Part tmp)
|
||||||
{
|
{
|
||||||
if (MyItem != null) MyItem.RefreshItemParts(); // Update List for old value
|
if (_ItemID != tmp.ItemID)
|
||||||
_ItemID = tmp.ItemID; // Update the value
|
{
|
||||||
}
|
if (MyItem != null) MyItem.RefreshItemParts(); // Update List for old value
|
||||||
_MyItem = null; // Reset list so that the next line gets a new list
|
_ItemID = tmp.ItemID; // Update the value
|
||||||
if (MyItem != null) MyItem.RefreshItemParts(); // Update List for new value
|
}
|
||||||
_DTS = tmp.DTS;
|
_MyItem = null; // Reset list so that the next line gets a new list
|
||||||
_UserID = tmp.UserID;
|
if (MyItem != null) MyItem.RefreshItemParts(); // Update List for new value
|
||||||
_PartInfoExtension.Refresh(this);
|
_DTS = tmp.DTS;
|
||||||
OnChange();// raise an event
|
_UserID = tmp.UserID;
|
||||||
}
|
_PartInfoExtension.Refresh(this);
|
||||||
public static void Refresh(Content myContent, ContentPart tmp)
|
OnChange();// raise an event
|
||||||
{
|
}
|
||||||
string key = myContent.ContentID.ToString() + "_" + tmp.FromType.ToString();
|
public static void Refresh(Content myContent, ContentPart tmp)
|
||||||
ConvertListToDictionary();
|
{
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
string key = myContent.ContentID.ToString() + "_" + tmp.FromType.ToString();
|
||||||
foreach (PartInfo tmpInfo in _CacheByPrimaryKey[key])
|
ConvertListToDictionary();
|
||||||
tmpInfo.RefreshFields(tmp);
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
}
|
foreach (PartInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
protected virtual void RefreshFields(ContentPart tmp)
|
tmpInfo.RefreshFields(tmp);
|
||||||
{
|
}
|
||||||
if (_ItemID != tmp.ItemID)
|
protected virtual void RefreshFields(ContentPart tmp)
|
||||||
{
|
{
|
||||||
if (MyItem != null) MyItem.RefreshItemParts(); // Update List for old value
|
if (_ItemID != tmp.ItemID)
|
||||||
_ItemID = tmp.ItemID; // Update the value
|
{
|
||||||
}
|
if (MyItem != null) MyItem.RefreshItemParts(); // Update List for old value
|
||||||
_MyItem = null; // Reset list so that the next line gets a new list
|
_ItemID = tmp.ItemID; // Update the value
|
||||||
if (MyItem != null) MyItem.RefreshItemParts(); // Update List for new value
|
}
|
||||||
_DTS = tmp.DTS;
|
_MyItem = null; // Reset list so that the next line gets a new list
|
||||||
_UserID = tmp.UserID;
|
if (MyItem != null) MyItem.RefreshItemParts(); // Update List for new value
|
||||||
_PartInfoExtension.Refresh(this);
|
_DTS = tmp.DTS;
|
||||||
OnChange();// raise an event
|
_UserID = tmp.UserID;
|
||||||
}
|
_PartInfoExtension.Refresh(this);
|
||||||
public static void Refresh(ItemPart tmp)
|
OnChange();// raise an event
|
||||||
{
|
}
|
||||||
string key = tmp.ContentID.ToString() + "_" + tmp.FromType.ToString();
|
public static void Refresh(ItemPart tmp)
|
||||||
ConvertListToDictionary();
|
{
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
string key = tmp.ContentID.ToString() + "_" + tmp.FromType.ToString();
|
||||||
foreach (PartInfo tmpInfo in _CacheByPrimaryKey[key])
|
ConvertListToDictionary();
|
||||||
tmpInfo.RefreshFields(tmp);
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
}
|
foreach (PartInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
protected virtual void RefreshFields(ItemPart tmp)
|
tmpInfo.RefreshFields(tmp);
|
||||||
{
|
}
|
||||||
_DTS = tmp.DTS;
|
protected virtual void RefreshFields(ItemPart tmp)
|
||||||
_UserID = tmp.UserID;
|
{
|
||||||
_PartInfoExtension.Refresh(this);
|
_DTS = tmp.DTS;
|
||||||
OnChange();// raise an event
|
_UserID = tmp.UserID;
|
||||||
}
|
_PartInfoExtension.Refresh(this);
|
||||||
public static PartInfo Get(int contentID, int fromType)
|
OnChange();// raise an event
|
||||||
{
|
}
|
||||||
//if (!CanGetObject())
|
public static PartInfo Get(int contentID, int fromType)
|
||||||
// throw new System.Security.SecurityException("User not authorized to view a Part");
|
{
|
||||||
try
|
//if (!CanGetObject())
|
||||||
{
|
// throw new System.Security.SecurityException("User not authorized to view a Part");
|
||||||
PartInfo tmp = GetCachedByPrimaryKey(contentID, fromType);
|
try
|
||||||
if (tmp == null)
|
{
|
||||||
{
|
PartInfo tmp = GetCachedByPrimaryKey(contentID, fromType);
|
||||||
tmp = DataPortal.Fetch<PartInfo>(new PKCriteria(contentID, fromType));
|
if (tmp == null)
|
||||||
AddToCache(tmp);
|
{
|
||||||
}
|
tmp = DataPortal.Fetch<PartInfo>(new PKCriteria(contentID, fromType));
|
||||||
if (tmp.ErrorMessage == "No Record Found")
|
AddToCache(tmp);
|
||||||
{
|
}
|
||||||
tmp.Dispose(); // Clean-up PartInfo
|
if (tmp.ErrorMessage == "No Record Found")
|
||||||
tmp = null;
|
{
|
||||||
}
|
tmp.Dispose(); // Clean-up PartInfo
|
||||||
return tmp;
|
tmp = null;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
return tmp;
|
||||||
{
|
}
|
||||||
throw new DbCslaException("Error on PartInfo.Get", ex);
|
catch (Exception ex)
|
||||||
}
|
{
|
||||||
}
|
throw new DbCslaException("Error on PartInfo.Get", ex);
|
||||||
#endregion
|
}
|
||||||
#region Data Access Portal
|
}
|
||||||
internal PartInfo(SafeDataReader dr)
|
#endregion
|
||||||
{
|
#region Data Access Portal
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PartInfo.Constructor", GetHashCode());
|
internal PartInfo(SafeDataReader dr)
|
||||||
try
|
{
|
||||||
{
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PartInfo.Constructor", GetHashCode());
|
||||||
ReadData(dr);
|
try
|
||||||
}
|
{
|
||||||
catch (Exception ex)
|
ReadData(dr);
|
||||||
{
|
}
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("PartInfo.Constructor", ex);
|
catch (Exception ex)
|
||||||
throw new DbCslaException("PartInfo.Constructor", ex);
|
{
|
||||||
}
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("PartInfo.Constructor", ex);
|
||||||
}
|
throw new DbCslaException("PartInfo.Constructor", ex);
|
||||||
[Serializable()]
|
}
|
||||||
protected class PKCriteria
|
}
|
||||||
{
|
[Serializable()]
|
||||||
private int _ContentID;
|
protected class PKCriteria
|
||||||
public int ContentID
|
{
|
||||||
{ get { return _ContentID; } }
|
private int _ContentID;
|
||||||
private int _FromType;
|
public int ContentID
|
||||||
public int FromType
|
{ get { return _ContentID; } }
|
||||||
{ get { return _FromType; } }
|
private int _FromType;
|
||||||
public PKCriteria(int contentID, int fromType)
|
public int FromType
|
||||||
{
|
{ get { return _FromType; } }
|
||||||
_ContentID = contentID;
|
public PKCriteria(int contentID, int fromType)
|
||||||
_FromType = fromType;
|
{
|
||||||
}
|
_ContentID = contentID;
|
||||||
}
|
_FromType = fromType;
|
||||||
private void ReadData(SafeDataReader dr)
|
}
|
||||||
{
|
}
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PartInfo.ReadData", GetHashCode());
|
private void ReadData(SafeDataReader dr)
|
||||||
try
|
{
|
||||||
{
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PartInfo.ReadData", GetHashCode());
|
||||||
_ContentID = dr.GetInt32("ContentID");
|
try
|
||||||
_FromType = dr.GetInt32("FromType");
|
{
|
||||||
_ItemID = dr.GetInt32("ItemID");
|
_ContentID = dr.GetInt32("ContentID");
|
||||||
_DTS = dr.GetDateTime("DTS");
|
_FromType = dr.GetInt32("FromType");
|
||||||
_UserID = dr.GetString("UserID");
|
_ItemID = dr.GetInt32("ItemID");
|
||||||
}
|
_DTS = dr.GetDateTime("DTS");
|
||||||
catch (Exception ex)
|
_UserID = dr.GetString("UserID");
|
||||||
{
|
}
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("PartInfo.ReadData", ex);
|
catch (Exception ex)
|
||||||
_ErrorMessage = ex.Message;
|
{
|
||||||
throw new DbCslaException("PartInfo.ReadData", ex);
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("PartInfo.ReadData", ex);
|
||||||
}
|
_ErrorMessage = ex.Message;
|
||||||
}
|
throw new DbCslaException("PartInfo.ReadData", ex);
|
||||||
private void DataPortal_Fetch(PKCriteria criteria)
|
}
|
||||||
{
|
}
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PartInfo.DataPortal_Fetch", GetHashCode());
|
private void DataPortal_Fetch(PKCriteria criteria)
|
||||||
try
|
{
|
||||||
{
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PartInfo.DataPortal_Fetch", GetHashCode());
|
||||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
try
|
||||||
{
|
{
|
||||||
ApplicationContext.LocalContext["cn"] = cn;
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
using (SqlCommand cm = cn.CreateCommand())
|
{
|
||||||
{
|
ApplicationContext.LocalContext["cn"] = cn;
|
||||||
cm.CommandType = CommandType.StoredProcedure;
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
cm.CommandText = "getPart";
|
{
|
||||||
cm.Parameters.AddWithValue("@ContentID", criteria.ContentID);
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
cm.Parameters.AddWithValue("@FromType", criteria.FromType);
|
cm.CommandText = "getPart";
|
||||||
cm.CommandTimeout = Database.DefaultTimeout;
|
cm.Parameters.AddWithValue("@ContentID", criteria.ContentID);
|
||||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
cm.Parameters.AddWithValue("@FromType", criteria.FromType);
|
||||||
{
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
if (!dr.Read())
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
{
|
{
|
||||||
_ErrorMessage = "No Record Found";
|
if (!dr.Read())
|
||||||
return;
|
{
|
||||||
}
|
_ErrorMessage = "No Record Found";
|
||||||
ReadData(dr);
|
return;
|
||||||
}
|
}
|
||||||
}
|
ReadData(dr);
|
||||||
// removing of item only needed for local data portal
|
}
|
||||||
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
}
|
||||||
ApplicationContext.LocalContext.Remove("cn");
|
// 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("PartInfo.DataPortal_Fetch", ex);
|
catch (Exception ex)
|
||||||
_ErrorMessage = ex.Message;
|
{
|
||||||
throw new DbCslaException("PartInfo.DataPortal_Fetch", ex);
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("PartInfo.DataPortal_Fetch", ex);
|
||||||
}
|
_ErrorMessage = ex.Message;
|
||||||
}
|
throw new DbCslaException("PartInfo.DataPortal_Fetch", ex);
|
||||||
#endregion
|
}
|
||||||
// Standard Refresh
|
}
|
||||||
#region extension
|
#endregion
|
||||||
PartInfoExtension _PartInfoExtension = new PartInfoExtension();
|
// Standard Refresh
|
||||||
[Serializable()]
|
#region extension
|
||||||
partial class PartInfoExtension : extensionBase { }
|
PartInfoExtension _PartInfoExtension = new PartInfoExtension();
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
class extensionBase
|
partial class PartInfoExtension : extensionBase { }
|
||||||
{
|
[Serializable()]
|
||||||
// Default Refresh
|
class extensionBase
|
||||||
public virtual void Refresh(PartInfo tmp) { }
|
{
|
||||||
}
|
// Default Refresh
|
||||||
#endregion
|
public virtual void Refresh(PartInfo tmp) { }
|
||||||
} // Class
|
}
|
||||||
#region Converter
|
#endregion
|
||||||
internal class PartInfoConverter : ExpandableObjectConverter
|
} // Class
|
||||||
{
|
#region Converter
|
||||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
internal class PartInfoConverter : ExpandableObjectConverter
|
||||||
{
|
{
|
||||||
if (destType == typeof(string) && value is PartInfo)
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
{
|
{
|
||||||
// Return the ToString value
|
if (destType == typeof(string) && value is PartInfo)
|
||||||
return ((PartInfo)value).ToString();
|
{
|
||||||
}
|
// Return the ToString value
|
||||||
return base.ConvertTo(context, culture, value, destType);
|
return ((PartInfo)value).ToString();
|
||||||
}
|
}
|
||||||
}
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
#endregion
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
@ -19,324 +19,324 @@ using System.ComponentModel;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// PartInfoList Generated by MyGeneration using the CSLA Object Mapping template
|
/// PartInfoList Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
[TypeConverter(typeof(PartInfoListConverter))]
|
[TypeConverter(typeof(PartInfoListConverter))]
|
||||||
public partial class PartInfoList : ReadOnlyListBase<PartInfoList, PartInfo>, ICustomTypeDescriptor, IDisposable
|
public partial class PartInfoList : ReadOnlyListBase<PartInfoList, PartInfo>, ICustomTypeDescriptor, IDisposable
|
||||||
{
|
{
|
||||||
#region Log4Net
|
#region Log4Net
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#endregion
|
#endregion
|
||||||
#region Business Methods
|
#region Business Methods
|
||||||
internal new IList<PartInfo> Items
|
internal new IList<PartInfo> Items
|
||||||
{ get { return base.Items; } }
|
{ get { return base.Items; } }
|
||||||
public void AddEvents()
|
public void AddEvents()
|
||||||
{
|
{
|
||||||
foreach (PartInfo tmp in this)
|
foreach (PartInfo tmp in this)
|
||||||
{
|
{
|
||||||
tmp.Changed += new PartInfoEvent(tmp_Changed);
|
tmp.Changed += new PartInfoEvent(tmp_Changed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void tmp_Changed(object sender)
|
void tmp_Changed(object sender)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < Count; i++)
|
for (int i = 0; i < Count; i++)
|
||||||
{
|
{
|
||||||
if (base[i] == sender)
|
if (base[i] == sender)
|
||||||
this.OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, i));
|
this.OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private bool _Disposed = false;
|
private bool _Disposed = false;
|
||||||
private static int _CountCreated = 0;
|
private static int _CountCreated = 0;
|
||||||
private static int _CountDisposed = 0;
|
private static int _CountDisposed = 0;
|
||||||
private static int _CountFinalized = 0;
|
private static int _CountFinalized = 0;
|
||||||
private static int IncrementCountCreated
|
private static int IncrementCountCreated
|
||||||
{ get { return ++_CountCreated; } }
|
{ get { return ++_CountCreated; } }
|
||||||
private int _CountWhenCreated = IncrementCountCreated;
|
private int _CountWhenCreated = IncrementCountCreated;
|
||||||
public static int CountCreated
|
public static int CountCreated
|
||||||
{ get { return _CountCreated; } }
|
{ get { return _CountCreated; } }
|
||||||
public static int CountNotDisposed
|
public static int CountNotDisposed
|
||||||
{ get { return _CountCreated - _CountDisposed; } }
|
{ get { return _CountCreated - _CountDisposed; } }
|
||||||
public static int CountNotFinalized
|
public static int CountNotFinalized
|
||||||
{ get { return _CountCreated - _CountFinalized; } }
|
{ get { return _CountCreated - _CountFinalized; } }
|
||||||
~PartInfoList()
|
~PartInfoList()
|
||||||
{
|
{
|
||||||
_CountFinalized++;
|
_CountFinalized++;
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
if (_Disposed) return;
|
if (_Disposed) return;
|
||||||
_CountDisposed++;
|
_CountDisposed++;
|
||||||
_Disposed = true;
|
_Disposed = true;
|
||||||
foreach (PartInfo tmp in this)
|
foreach (PartInfo tmp in this)
|
||||||
{
|
{
|
||||||
tmp.Changed -= new PartInfoEvent(tmp_Changed);
|
tmp.Changed -= tmp_Changed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
public static PartInfoList _PartInfoList = null;
|
public static PartInfoList _PartInfoList = null;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return a list of all PartInfo.
|
/// Return a list of all PartInfo.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static PartInfoList Get()
|
public static PartInfoList Get()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (_PartInfoList != null)
|
if (_PartInfoList != null)
|
||||||
return _PartInfoList;
|
return _PartInfoList;
|
||||||
PartInfoList tmp = DataPortal.Fetch<PartInfoList>();
|
PartInfoList tmp = DataPortal.Fetch<PartInfoList>();
|
||||||
PartInfo.AddList(tmp);
|
PartInfo.AddList(tmp);
|
||||||
tmp.AddEvents();
|
tmp.AddEvents();
|
||||||
_PartInfoList = tmp;
|
_PartInfoList = tmp;
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
throw new DbCslaException("Error on PartInfoList.Get", ex);
|
throw new DbCslaException("Error on PartInfoList.Get", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reset the list of all PartInfo.
|
/// Reset the list of all PartInfo.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void Reset()
|
public static void Reset()
|
||||||
{
|
{
|
||||||
_PartInfoList = null;
|
_PartInfoList = null;
|
||||||
}
|
}
|
||||||
// CSLATODO: Add alternative gets -
|
// CSLATODO: Add alternative gets -
|
||||||
//public static PartInfoList Get(<criteria>)
|
//public static PartInfoList Get(<criteria>)
|
||||||
//{
|
//{
|
||||||
// try
|
// try
|
||||||
// {
|
// {
|
||||||
// return DataPortal.Fetch<PartInfoList>(new FilteredCriteria(<criteria>));
|
// return DataPortal.Fetch<PartInfoList>(new FilteredCriteria(<criteria>));
|
||||||
// }
|
// }
|
||||||
// catch (Exception ex)
|
// catch (Exception ex)
|
||||||
// {
|
// {
|
||||||
// throw new DbCslaException("Error on PartInfoList.Get", ex);
|
// throw new DbCslaException("Error on PartInfoList.Get", ex);
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
public static PartInfoList GetByContentID(int contentID)
|
public static PartInfoList GetByContentID(int contentID)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PartInfoList tmp = DataPortal.Fetch<PartInfoList>(new ContentIDCriteria(contentID));
|
PartInfoList tmp = DataPortal.Fetch<PartInfoList>(new ContentIDCriteria(contentID));
|
||||||
PartInfo.AddList(tmp);
|
PartInfo.AddList(tmp);
|
||||||
tmp.AddEvents();
|
tmp.AddEvents();
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
throw new DbCslaException("Error on PartInfoList.GetByContentID", ex);
|
throw new DbCslaException("Error on PartInfoList.GetByContentID", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static PartInfoList GetByItemID(int itemID)
|
public static PartInfoList GetByItemID(int itemID)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PartInfoList tmp = DataPortal.Fetch<PartInfoList>(new ItemIDCriteria(itemID));
|
PartInfoList tmp = DataPortal.Fetch<PartInfoList>(new ItemIDCriteria(itemID));
|
||||||
PartInfo.AddList(tmp);
|
PartInfo.AddList(tmp);
|
||||||
tmp.AddEvents();
|
tmp.AddEvents();
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
throw new DbCslaException("Error on PartInfoList.GetByItemID", ex);
|
throw new DbCslaException("Error on PartInfoList.GetByItemID", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private PartInfoList()
|
private PartInfoList()
|
||||||
{ /* require use of factory methods */ }
|
{ /* require use of factory methods */ }
|
||||||
#endregion
|
#endregion
|
||||||
#region Data Access Portal
|
#region Data Access Portal
|
||||||
private void DataPortal_Fetch()
|
private void DataPortal_Fetch()
|
||||||
{
|
{
|
||||||
this.RaiseListChangedEvents = false;
|
this.RaiseListChangedEvents = false;
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PartInfoList.DataPortal_Fetch", GetHashCode());
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PartInfoList.DataPortal_Fetch", GetHashCode());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
{
|
{
|
||||||
using (SqlCommand cm = cn.CreateCommand())
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
{
|
{
|
||||||
cm.CommandType = CommandType.StoredProcedure;
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
cm.CommandText = "getParts";
|
cm.CommandText = "getParts";
|
||||||
cm.CommandTimeout = Database.DefaultTimeout;
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
{
|
{
|
||||||
IsReadOnly = false;
|
IsReadOnly = false;
|
||||||
while (dr.Read()) this.Add(new PartInfo(dr));
|
while (dr.Read()) this.Add(new PartInfo(dr));
|
||||||
IsReadOnly = true;
|
IsReadOnly = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("PartInfoList.DataPortal_Fetch", ex);
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("PartInfoList.DataPortal_Fetch", ex);
|
||||||
throw new DbCslaException("PartInfoList.DataPortal_Fetch", ex);
|
throw new DbCslaException("PartInfoList.DataPortal_Fetch", ex);
|
||||||
}
|
}
|
||||||
this.RaiseListChangedEvents = true;
|
this.RaiseListChangedEvents = true;
|
||||||
}
|
}
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
private class ContentIDCriteria
|
private class ContentIDCriteria
|
||||||
{
|
{
|
||||||
public ContentIDCriteria(int contentID)
|
public ContentIDCriteria(int contentID)
|
||||||
{
|
{
|
||||||
_ContentID = contentID;
|
_ContentID = contentID;
|
||||||
}
|
}
|
||||||
private int _ContentID;
|
private int _ContentID;
|
||||||
public int ContentID
|
public int ContentID
|
||||||
{
|
{
|
||||||
get { return _ContentID; }
|
get { return _ContentID; }
|
||||||
set { _ContentID = value; }
|
set { _ContentID = value; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void DataPortal_Fetch(ContentIDCriteria criteria)
|
private void DataPortal_Fetch(ContentIDCriteria criteria)
|
||||||
{
|
{
|
||||||
this.RaiseListChangedEvents = false;
|
this.RaiseListChangedEvents = false;
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PartInfoList.DataPortal_FetchContentID", GetHashCode());
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PartInfoList.DataPortal_FetchContentID", GetHashCode());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
{
|
{
|
||||||
using (SqlCommand cm = cn.CreateCommand())
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
{
|
{
|
||||||
cm.CommandType = CommandType.StoredProcedure;
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
cm.CommandText = "getPartsByContentID";
|
cm.CommandText = "getPartsByContentID";
|
||||||
cm.Parameters.AddWithValue("@ContentID", criteria.ContentID);
|
cm.Parameters.AddWithValue("@ContentID", criteria.ContentID);
|
||||||
cm.CommandTimeout = Database.DefaultTimeout;
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
{
|
{
|
||||||
IsReadOnly = false;
|
IsReadOnly = false;
|
||||||
while (dr.Read()) this.Add(new PartInfo(dr));
|
while (dr.Read()) this.Add(new PartInfo(dr));
|
||||||
IsReadOnly = true;
|
IsReadOnly = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("PartInfoList.DataPortal_FetchContentID", ex);
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("PartInfoList.DataPortal_FetchContentID", ex);
|
||||||
throw new DbCslaException("PartInfoList.DataPortal_Fetch", ex);
|
throw new DbCslaException("PartInfoList.DataPortal_Fetch", ex);
|
||||||
}
|
}
|
||||||
this.RaiseListChangedEvents = true;
|
this.RaiseListChangedEvents = true;
|
||||||
}
|
}
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
private class ItemIDCriteria
|
private class ItemIDCriteria
|
||||||
{
|
{
|
||||||
public ItemIDCriteria(int itemID)
|
public ItemIDCriteria(int itemID)
|
||||||
{
|
{
|
||||||
_ItemID = itemID;
|
_ItemID = itemID;
|
||||||
}
|
}
|
||||||
private int _ItemID;
|
private int _ItemID;
|
||||||
public int ItemID
|
public int ItemID
|
||||||
{
|
{
|
||||||
get { return _ItemID; }
|
get { return _ItemID; }
|
||||||
set { _ItemID = value; }
|
set { _ItemID = value; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void DataPortal_Fetch(ItemIDCriteria criteria)
|
private void DataPortal_Fetch(ItemIDCriteria criteria)
|
||||||
{
|
{
|
||||||
this.RaiseListChangedEvents = false;
|
this.RaiseListChangedEvents = false;
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PartInfoList.DataPortal_FetchItemID", GetHashCode());
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PartInfoList.DataPortal_FetchItemID", GetHashCode());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
{
|
{
|
||||||
using (SqlCommand cm = cn.CreateCommand())
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
{
|
{
|
||||||
cm.CommandType = CommandType.StoredProcedure;
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
cm.CommandText = "getPartsByItemID";
|
cm.CommandText = "getPartsByItemID";
|
||||||
cm.Parameters.AddWithValue("@ItemID", criteria.ItemID);
|
cm.Parameters.AddWithValue("@ItemID", criteria.ItemID);
|
||||||
cm.CommandTimeout = Database.DefaultTimeout;
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
{
|
{
|
||||||
IsReadOnly = false;
|
IsReadOnly = false;
|
||||||
while (dr.Read()) this.Add(new PartInfo(dr));
|
while (dr.Read()) this.Add(new PartInfo(dr));
|
||||||
IsReadOnly = true;
|
IsReadOnly = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("PartInfoList.DataPortal_FetchItemID", ex);
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("PartInfoList.DataPortal_FetchItemID", ex);
|
||||||
throw new DbCslaException("PartInfoList.DataPortal_Fetch", ex);
|
throw new DbCslaException("PartInfoList.DataPortal_Fetch", ex);
|
||||||
}
|
}
|
||||||
this.RaiseListChangedEvents = true;
|
this.RaiseListChangedEvents = true;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region ICustomTypeDescriptor impl
|
#region ICustomTypeDescriptor impl
|
||||||
public String GetClassName()
|
public String GetClassName()
|
||||||
{ return TypeDescriptor.GetClassName(this, true); }
|
{ return TypeDescriptor.GetClassName(this, true); }
|
||||||
public AttributeCollection GetAttributes()
|
public AttributeCollection GetAttributes()
|
||||||
{ return TypeDescriptor.GetAttributes(this, true); }
|
{ return TypeDescriptor.GetAttributes(this, true); }
|
||||||
public String GetComponentName()
|
public String GetComponentName()
|
||||||
{ return TypeDescriptor.GetComponentName(this, true); }
|
{ return TypeDescriptor.GetComponentName(this, true); }
|
||||||
public TypeConverter GetConverter()
|
public TypeConverter GetConverter()
|
||||||
{ return TypeDescriptor.GetConverter(this, true); }
|
{ return TypeDescriptor.GetConverter(this, true); }
|
||||||
public EventDescriptor GetDefaultEvent()
|
public EventDescriptor GetDefaultEvent()
|
||||||
{ return TypeDescriptor.GetDefaultEvent(this, true); }
|
{ return TypeDescriptor.GetDefaultEvent(this, true); }
|
||||||
public PropertyDescriptor GetDefaultProperty()
|
public PropertyDescriptor GetDefaultProperty()
|
||||||
{ return TypeDescriptor.GetDefaultProperty(this, true); }
|
{ return TypeDescriptor.GetDefaultProperty(this, true); }
|
||||||
public object GetEditor(Type editorBaseType)
|
public object GetEditor(Type editorBaseType)
|
||||||
{ return TypeDescriptor.GetEditor(this, editorBaseType, true); }
|
{ return TypeDescriptor.GetEditor(this, editorBaseType, true); }
|
||||||
public EventDescriptorCollection GetEvents(Attribute[] attributes)
|
public EventDescriptorCollection GetEvents(Attribute[] attributes)
|
||||||
{ return TypeDescriptor.GetEvents(this, attributes, true); }
|
{ return TypeDescriptor.GetEvents(this, attributes, true); }
|
||||||
public EventDescriptorCollection GetEvents()
|
public EventDescriptorCollection GetEvents()
|
||||||
{ return TypeDescriptor.GetEvents(this, true); }
|
{ return TypeDescriptor.GetEvents(this, true); }
|
||||||
public object GetPropertyOwner(PropertyDescriptor pd)
|
public object GetPropertyOwner(PropertyDescriptor pd)
|
||||||
{ return this; }
|
{ return this; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called to get the properties of this type. Returns properties with certain
|
/// Called to get the properties of this type. Returns properties with certain
|
||||||
/// attributes. this restriction is not implemented here.
|
/// attributes. this restriction is not implemented here.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="attributes"></param>
|
/// <param name="attributes"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
|
public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
|
||||||
{ return GetProperties(); }
|
{ return GetProperties(); }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called to get the properties of this type.
|
/// Called to get the properties of this type.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public PropertyDescriptorCollection GetProperties()
|
public PropertyDescriptorCollection GetProperties()
|
||||||
{
|
{
|
||||||
// Create a collection object to hold property descriptors
|
// Create a collection object to hold property descriptors
|
||||||
PropertyDescriptorCollection pds = new PropertyDescriptorCollection(null);
|
PropertyDescriptorCollection pds = new PropertyDescriptorCollection(null);
|
||||||
// Iterate the list
|
// Iterate the list
|
||||||
for (int i = 0; i < this.Items.Count; i++)
|
for (int i = 0; i < this.Items.Count; i++)
|
||||||
{
|
{
|
||||||
// Create a property descriptor for the item and add to the property descriptor collection
|
// Create a property descriptor for the item and add to the property descriptor collection
|
||||||
PartInfoListPropertyDescriptor pd = new PartInfoListPropertyDescriptor(this, i);
|
PartInfoListPropertyDescriptor pd = new PartInfoListPropertyDescriptor(this, i);
|
||||||
pds.Add(pd);
|
pds.Add(pd);
|
||||||
}
|
}
|
||||||
// return the property descriptor collection
|
// return the property descriptor collection
|
||||||
return pds;
|
return pds;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
} // Class
|
} // Class
|
||||||
#region Property Descriptor
|
#region Property Descriptor
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Summary description for CollectionPropertyDescriptor.
|
/// Summary description for CollectionPropertyDescriptor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class PartInfoListPropertyDescriptor : vlnListPropertyDescriptor
|
public partial class PartInfoListPropertyDescriptor : vlnListPropertyDescriptor
|
||||||
{
|
{
|
||||||
private PartInfo Item { get { return (PartInfo)_Item; } }
|
private PartInfo Item { get { return (PartInfo)_Item; } }
|
||||||
public PartInfoListPropertyDescriptor(PartInfoList collection, int index) : base(collection, index) { ;}
|
public PartInfoListPropertyDescriptor(PartInfoList collection, int index) : base(collection, index) {; }
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Converter
|
#region Converter
|
||||||
internal class PartInfoListConverter : ExpandableObjectConverter
|
internal class PartInfoListConverter : ExpandableObjectConverter
|
||||||
{
|
{
|
||||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
{
|
{
|
||||||
if (destType == typeof(string) && value is PartInfoList)
|
if (destType == typeof(string) && value is PartInfoList)
|
||||||
{
|
{
|
||||||
// Return department and department role separated by comma.
|
// Return department and department role separated by comma.
|
||||||
return ((PartInfoList)value).Items.Count.ToString() + " Parts";
|
return ((PartInfoList)value).Items.Count.ToString() + " Parts";
|
||||||
}
|
}
|
||||||
return base.ConvertTo(context, culture, value, destType);
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -19,471 +19,460 @@ using System.ComponentModel;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
public delegate void PdfInfoEvent(object sender);
|
public delegate void PdfInfoEvent(object sender);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// PdfInfo Generated by MyGeneration using the CSLA Object Mapping template
|
/// PdfInfo Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
[TypeConverter(typeof(PdfInfoConverter))]
|
[TypeConverter(typeof(PdfInfoConverter))]
|
||||||
public partial class PdfInfo : ReadOnlyBase<PdfInfo>, IDisposable
|
public partial class PdfInfo : ReadOnlyBase<PdfInfo>, IDisposable
|
||||||
{
|
{
|
||||||
public event PdfInfoEvent Changed;
|
public event PdfInfoEvent Changed;
|
||||||
private void OnChange()
|
private void OnChange()
|
||||||
{
|
{
|
||||||
if (Changed != null) Changed(this);
|
if (Changed != null) Changed(this);
|
||||||
}
|
}
|
||||||
#region Log4Net
|
#region Log4Net
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
private static List<PdfInfo> _CacheList = new List<PdfInfo>();
|
private static List<PdfInfo> _CacheList = new List<PdfInfo>();
|
||||||
protected static void AddToCache(PdfInfo pdfInfo)
|
protected static void AddToCache(PdfInfo pdfInfo)
|
||||||
{
|
{
|
||||||
if (!_CacheList.Contains(pdfInfo)) _CacheList.Add(pdfInfo); // In AddToCache
|
if (!_CacheList.Contains(pdfInfo)) _CacheList.Add(pdfInfo); // In AddToCache
|
||||||
}
|
}
|
||||||
protected static void RemoveFromCache(PdfInfo pdfInfo)
|
protected static void RemoveFromCache(PdfInfo pdfInfo)
|
||||||
{
|
{
|
||||||
while (_CacheList.Contains(pdfInfo)) _CacheList.Remove(pdfInfo); // In RemoveFromCache
|
while (_CacheList.Contains(pdfInfo)) _CacheList.Remove(pdfInfo); // In RemoveFromCache
|
||||||
}
|
}
|
||||||
private static Dictionary<string, List<PdfInfo>> _CacheByPrimaryKey = new Dictionary<string, List<PdfInfo>>();
|
private static Dictionary<string, List<PdfInfo>> _CacheByPrimaryKey = new Dictionary<string, List<PdfInfo>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
while (_CacheList.Count > 0) // Move PdfInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
while (_CacheList.Count > 0) // Move PdfInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
||||||
{
|
{
|
||||||
PdfInfo tmp = _CacheList[0]; // Get the first PdfInfo
|
PdfInfo tmp = _CacheList[0]; // Get the first PdfInfo
|
||||||
string pKey = tmp.DocID.ToString() + "_" + tmp.DebugStatus.ToString() + "_" + tmp.TopRow.ToString() + "_" + tmp.PageLength.ToString() + "_" + tmp.LeftMargin.ToString() + "_" + tmp.PageWidth.ToString();
|
string pKey = tmp.DocID.ToString() + "_" + tmp.DebugStatus.ToString() + "_" + tmp.TopRow.ToString() + "_" + tmp.PageLength.ToString() + "_" + tmp.LeftMargin.ToString() + "_" + tmp.PageWidth.ToString();
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
||||||
{
|
{
|
||||||
_CacheByPrimaryKey[pKey] = new List<PdfInfo>(); // Add new list for PrimaryKey
|
_CacheByPrimaryKey[pKey] = new List<PdfInfo>(); // Add new list for PrimaryKey
|
||||||
}
|
}
|
||||||
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
||||||
_CacheList.RemoveAt(0); // Remove the first PdfInfo
|
_CacheList.RemoveAt(0); // Remove the first PdfInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
internal static void AddList(PdfInfoList lst)
|
internal static void AddList(PdfInfoList lst)
|
||||||
{
|
{
|
||||||
foreach (PdfInfo item in lst) AddToCache(item);
|
foreach (PdfInfo item in lst) AddToCache(item);
|
||||||
}
|
}
|
||||||
protected static PdfInfo GetCachedByPrimaryKey(int docID, int debugStatus, int topRow, int pageLength, int leftMargin, int pageWidth)
|
protected static PdfInfo GetCachedByPrimaryKey(int docID, int debugStatus, int topRow, int pageLength, int leftMargin, int pageWidth)
|
||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = docID.ToString() + "_" + debugStatus.ToString() + "_" + topRow.ToString() + "_" + pageLength.ToString() + "_" + leftMargin.ToString() + "_" + pageWidth.ToString();
|
string key = docID.ToString() + "_" + debugStatus.ToString() + "_" + topRow.ToString() + "_" + pageLength.ToString() + "_" + leftMargin.ToString() + "_" + pageWidth.ToString();
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// B2023-024 PROMS was using old cached PDF data when printing Word sections.
|
// B2023-024 PROMS was using old cached PDF data when printing Word sections.
|
||||||
// Added this method to clear the PDF print cache for a specified section.
|
// Added this method to clear the PDF print cache for a specified section.
|
||||||
// This is called from RemovePDFFromCache() in PDFExt.cs
|
// This is called from RemovePDFFromCache() in PDFExt.cs
|
||||||
protected static void RemoveFromCachedByPrimaryKey(int docID, int debugStatus, int topRow, int pageLength, int leftMargin, int pageWidth)
|
protected static void RemoveFromCachedByPrimaryKey(int docID, int debugStatus, int topRow, int pageLength, int leftMargin, int pageWidth)
|
||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = docID.ToString() + "_" + debugStatus.ToString() + "_" + topRow.ToString() + "_" + pageLength.ToString() + "_" + leftMargin.ToString() + "_" + pageWidth.ToString();
|
string key = docID.ToString() + "_" + debugStatus.ToString() + "_" + topRow.ToString() + "_" + pageLength.ToString() + "_" + leftMargin.ToString() + "_" + pageWidth.ToString();
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
{
|
{
|
||||||
_CacheByPrimaryKey.Remove(key);
|
_CacheByPrimaryKey.Remove(key);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Business Methods
|
#region Business Methods
|
||||||
private string _ErrorMessage = string.Empty;
|
private string _ErrorMessage = string.Empty;
|
||||||
public string ErrorMessage
|
public string ErrorMessage
|
||||||
{
|
{
|
||||||
get { return _ErrorMessage; }
|
get { return _ErrorMessage; }
|
||||||
}
|
}
|
||||||
protected Pdf _Editable;
|
protected Pdf _Editable;
|
||||||
private IVEHasBrokenRules HasBrokenRules
|
private IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
IVEHasBrokenRules hasBrokenRules = null;
|
IVEHasBrokenRules hasBrokenRules = null;
|
||||||
if (_Editable != null)
|
if (_Editable != null)
|
||||||
hasBrokenRules = _Editable.HasBrokenRules;
|
hasBrokenRules = _Editable.HasBrokenRules;
|
||||||
return hasBrokenRules;
|
return hasBrokenRules;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private int _DocID;
|
private int _DocID;
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
public int DocID
|
public int DocID
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("DocID", true);
|
if (_MyDocument != null) _DocID = _MyDocument.DocID;
|
||||||
if (_MyDocument != null) _DocID = _MyDocument.DocID;
|
return _DocID;
|
||||||
return _DocID;
|
}
|
||||||
}
|
}
|
||||||
}
|
private DocumentInfo _MyDocument;
|
||||||
private DocumentInfo _MyDocument;
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
public DocumentInfo MyDocument
|
||||||
public DocumentInfo MyDocument
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
get
|
||||||
get
|
{
|
||||||
{
|
if (_MyDocument == null && _DocID != 0) _MyDocument = DocumentInfo.Get(_DocID);
|
||||||
CanReadProperty("MyDocument", true);
|
return _MyDocument;
|
||||||
if (_MyDocument == null && _DocID != 0) _MyDocument = DocumentInfo.Get(_DocID);
|
}
|
||||||
return _MyDocument;
|
}
|
||||||
}
|
private int _DebugStatus;
|
||||||
}
|
/// <summary>
|
||||||
private int _DebugStatus;
|
/// > 0 for Debug
|
||||||
/// <summary>
|
/// </summary>
|
||||||
/// > 0 for Debug
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
/// </summary>
|
public int DebugStatus
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
{
|
||||||
public int DebugStatus
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
return _DebugStatus;
|
||||||
{
|
}
|
||||||
CanReadProperty("DebugStatus", true);
|
}
|
||||||
return _DebugStatus;
|
private int _TopRow;
|
||||||
}
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
}
|
public int TopRow
|
||||||
private int _TopRow;
|
{
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
public int TopRow
|
get
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
return _TopRow;
|
||||||
get
|
}
|
||||||
{
|
}
|
||||||
CanReadProperty("TopRow", true);
|
private int _PageLength;
|
||||||
return _TopRow;
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
}
|
public int PageLength
|
||||||
}
|
{
|
||||||
private int _PageLength;
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
get
|
||||||
public int PageLength
|
{
|
||||||
{
|
return _PageLength;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
}
|
||||||
{
|
private int _LeftMargin;
|
||||||
CanReadProperty("PageLength", true);
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
return _PageLength;
|
public int LeftMargin
|
||||||
}
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
private int _LeftMargin;
|
get
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
{
|
||||||
public int LeftMargin
|
return _LeftMargin;
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
}
|
||||||
get
|
private int _PageWidth;
|
||||||
{
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
CanReadProperty("LeftMargin", true);
|
public int PageWidth
|
||||||
return _LeftMargin;
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
}
|
get
|
||||||
private int _PageWidth;
|
{
|
||||||
[System.ComponentModel.DataObjectField(true, true)]
|
return _PageWidth;
|
||||||
public int PageWidth
|
}
|
||||||
{
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
private double _PageCount;
|
||||||
get
|
/// <summary>
|
||||||
{
|
/// Count of whole and partial pages
|
||||||
CanReadProperty("PageWidth", true);
|
/// </summary>
|
||||||
return _PageWidth;
|
public double PageCount
|
||||||
}
|
{
|
||||||
}
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
private double _PageCount;
|
get
|
||||||
/// <summary>
|
{
|
||||||
/// Count of whole and partial pages
|
return _PageCount;
|
||||||
/// </summary>
|
}
|
||||||
public double PageCount
|
}
|
||||||
{
|
private byte[] _DocPdf;
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
public byte[] DocPdf
|
||||||
get
|
{
|
||||||
{
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
CanReadProperty("PageCount", true);
|
get
|
||||||
return _PageCount;
|
{
|
||||||
}
|
return _DocPdf;
|
||||||
}
|
}
|
||||||
private byte[] _DocPdf;
|
}
|
||||||
public byte[] DocPdf
|
private DateTime _DTS = new DateTime();
|
||||||
{
|
public DateTime DTS
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
{
|
||||||
get
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
{
|
get
|
||||||
CanReadProperty("DocPdf", true);
|
{
|
||||||
return _DocPdf;
|
return _DTS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private DateTime _DTS = new DateTime();
|
private string _UserID = string.Empty;
|
||||||
public DateTime DTS
|
public string UserID
|
||||||
{
|
{
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("DTS", true);
|
return _UserID;
|
||||||
return _DTS;
|
}
|
||||||
}
|
}
|
||||||
}
|
// CSLATODO: Replace base PdfInfo.ToString function as necessary
|
||||||
private string _UserID = string.Empty;
|
/// <summary>
|
||||||
public string UserID
|
/// Overrides Base ToString
|
||||||
{
|
/// </summary>
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
/// <returns>A string representation of current PdfInfo</returns>
|
||||||
get
|
//public override string ToString()
|
||||||
{
|
//{
|
||||||
CanReadProperty("UserID", true);
|
// return base.ToString();
|
||||||
return _UserID;
|
//}
|
||||||
}
|
// CSLATODO: Check PdfInfo.GetIdValue to assure that the ID returned is unique
|
||||||
}
|
/// <summary>
|
||||||
// CSLATODO: Replace base PdfInfo.ToString function as necessary
|
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||||
/// <summary>
|
/// </summary>
|
||||||
/// Overrides Base ToString
|
/// <returns>A Unique ID for the current PdfInfo</returns>
|
||||||
/// </summary>
|
protected override object GetIdValue()
|
||||||
/// <returns>A string representation of current PdfInfo</returns>
|
{
|
||||||
//public override string ToString()
|
return MyPdfInfoUnique; // Absolutely Unique ID
|
||||||
//{
|
}
|
||||||
// return base.ToString();
|
#endregion
|
||||||
//}
|
#region Factory Methods
|
||||||
// CSLATODO: Check PdfInfo.GetIdValue to assure that the ID returned is unique
|
private static int _PdfInfoUnique = 0;
|
||||||
/// <summary>
|
private static int PdfInfoUnique
|
||||||
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
{ get { return ++_PdfInfoUnique; } }
|
||||||
/// </summary>
|
private int _MyPdfInfoUnique = PdfInfoUnique;
|
||||||
/// <returns>A Unique ID for the current PdfInfo</returns>
|
public int MyPdfInfoUnique // Absolutely Unique ID - Info
|
||||||
protected override object GetIdValue()
|
{ get { return _MyPdfInfoUnique; } }
|
||||||
{
|
protected PdfInfo()
|
||||||
return MyPdfInfoUnique; // Absolutely Unique ID
|
{/* require use of factory methods */
|
||||||
}
|
AddToCache(this);
|
||||||
#endregion
|
}
|
||||||
#region Factory Methods
|
private bool _Disposed = false;
|
||||||
private static int _PdfInfoUnique = 0;
|
private static int _CountCreated = 0;
|
||||||
private static int PdfInfoUnique
|
private static int _CountDisposed = 0;
|
||||||
{ get { return ++_PdfInfoUnique; } }
|
private static int _CountFinalized = 0;
|
||||||
private int _MyPdfInfoUnique = PdfInfoUnique;
|
private static int IncrementCountCreated
|
||||||
public int MyPdfInfoUnique // Absolutely Unique ID - Info
|
{ get { return ++_CountCreated; } }
|
||||||
{ get { return _MyPdfInfoUnique; } }
|
private int _CountWhenCreated = IncrementCountCreated;
|
||||||
protected PdfInfo()
|
public static int CountCreated
|
||||||
{/* require use of factory methods */
|
{ get { return _CountCreated; } }
|
||||||
AddToCache(this);
|
public static int CountNotDisposed
|
||||||
}
|
{ get { return _CountCreated - _CountDisposed; } }
|
||||||
private bool _Disposed = false;
|
public static int CountNotFinalized
|
||||||
private static int _CountCreated = 0;
|
{ get { return _CountCreated - _CountFinalized; } }
|
||||||
private static int _CountDisposed = 0;
|
~PdfInfo()
|
||||||
private static int _CountFinalized = 0;
|
{
|
||||||
private static int IncrementCountCreated
|
_CountFinalized++;
|
||||||
{ get { return ++_CountCreated; } }
|
}
|
||||||
private int _CountWhenCreated = IncrementCountCreated;
|
public void Dispose()
|
||||||
public static int CountCreated
|
{
|
||||||
{ get { return _CountCreated; } }
|
if (_Disposed) return;
|
||||||
public static int CountNotDisposed
|
_CountDisposed++;
|
||||||
{ get { return _CountCreated - _CountDisposed; } }
|
_Disposed = true;
|
||||||
public static int CountNotFinalized
|
RemoveFromCache(this);
|
||||||
{ get { return _CountCreated - _CountFinalized; } }
|
if (!_CacheByPrimaryKey.ContainsKey(DocID.ToString() + "_" + DebugStatus.ToString() + "_" + TopRow.ToString() + "_" + PageLength.ToString() + "_" + LeftMargin.ToString() + "_" + PageWidth.ToString())) return;
|
||||||
~PdfInfo()
|
List<PdfInfo> listPdfInfo = _CacheByPrimaryKey[DocID.ToString() + "_" + DebugStatus.ToString() + "_" + TopRow.ToString() + "_" + PageLength.ToString() + "_" + LeftMargin.ToString() + "_" + PageWidth.ToString()]; // Get the list of items
|
||||||
{
|
while (listPdfInfo.Contains(this)) listPdfInfo.Remove(this); // Remove the item from the list
|
||||||
_CountFinalized++;
|
if (listPdfInfo.Count == 0) // If there are no items left in the list
|
||||||
}
|
_CacheByPrimaryKey.Remove(DocID.ToString() + "_" + DebugStatus.ToString() + "_" + TopRow.ToString() + "_" + PageLength.ToString() + "_" + LeftMargin.ToString() + "_" + PageWidth.ToString()); // remove the list
|
||||||
public void Dispose()
|
}
|
||||||
{
|
public virtual Pdf Get()
|
||||||
if (_Disposed) return;
|
{
|
||||||
_CountDisposed++;
|
return _Editable = Pdf.Get(_DocID, _DebugStatus, _TopRow, _PageLength, _LeftMargin, _PageWidth);
|
||||||
_Disposed = true;
|
}
|
||||||
RemoveFromCache(this);
|
public static void Refresh(Pdf tmp)
|
||||||
if (!_CacheByPrimaryKey.ContainsKey(DocID.ToString() + "_" + DebugStatus.ToString() + "_" + TopRow.ToString() + "_" + PageLength.ToString() + "_" + LeftMargin.ToString() + "_" + PageWidth.ToString())) return;
|
{
|
||||||
List<PdfInfo> listPdfInfo = _CacheByPrimaryKey[DocID.ToString() + "_" + DebugStatus.ToString() + "_" + TopRow.ToString() + "_" + PageLength.ToString() + "_" + LeftMargin.ToString() + "_" + PageWidth.ToString()]; // Get the list of items
|
string key = tmp.DocID.ToString() + "_" + tmp.DebugStatus.ToString() + "_" + tmp.TopRow.ToString() + "_" + tmp.PageLength.ToString() + "_" + tmp.LeftMargin.ToString() + "_" + tmp.PageWidth.ToString();
|
||||||
while (listPdfInfo.Contains(this)) listPdfInfo.Remove(this); // Remove the item from the list
|
ConvertListToDictionary();
|
||||||
if (listPdfInfo.Count == 0) // If there are no items left in the list
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
_CacheByPrimaryKey.Remove(DocID.ToString() + "_" + DebugStatus.ToString() + "_" + TopRow.ToString() + "_" + PageLength.ToString() + "_" + LeftMargin.ToString() + "_" + PageWidth.ToString()); // remove the list
|
foreach (PdfInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
}
|
tmpInfo.RefreshFields(tmp);
|
||||||
public virtual Pdf Get()
|
}
|
||||||
{
|
protected virtual void RefreshFields(Pdf tmp)
|
||||||
return _Editable = Pdf.Get(_DocID, _DebugStatus, _TopRow, _PageLength, _LeftMargin, _PageWidth);
|
{
|
||||||
}
|
_PageCount = tmp.PageCount;
|
||||||
public static void Refresh(Pdf tmp)
|
_DocPdf = tmp.DocPdf;
|
||||||
{
|
_DTS = tmp.DTS;
|
||||||
string key = tmp.DocID.ToString() + "_" + tmp.DebugStatus.ToString() + "_" + tmp.TopRow.ToString() + "_" + tmp.PageLength.ToString() + "_" + tmp.LeftMargin.ToString() + "_" + tmp.PageWidth.ToString();
|
_UserID = tmp.UserID;
|
||||||
ConvertListToDictionary();
|
_PdfInfoExtension.Refresh(this);
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
OnChange();// raise an event
|
||||||
foreach (PdfInfo tmpInfo in _CacheByPrimaryKey[key])
|
}
|
||||||
tmpInfo.RefreshFields(tmp);
|
public static void Refresh(Document myDocument, DocumentPdf tmp)
|
||||||
}
|
{
|
||||||
protected virtual void RefreshFields(Pdf tmp)
|
string key = myDocument.DocID.ToString() + "_" + tmp.DebugStatus.ToString() + "_" + tmp.TopRow.ToString() + "_" + tmp.PageLength.ToString() + "_" + tmp.LeftMargin.ToString() + "_" + tmp.PageWidth.ToString();
|
||||||
{
|
ConvertListToDictionary();
|
||||||
_PageCount = tmp.PageCount;
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
_DocPdf = tmp.DocPdf;
|
foreach (PdfInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
_DTS = tmp.DTS;
|
tmpInfo.RefreshFields(tmp);
|
||||||
_UserID = tmp.UserID;
|
}
|
||||||
_PdfInfoExtension.Refresh(this);
|
protected virtual void RefreshFields(DocumentPdf tmp)
|
||||||
OnChange();// raise an event
|
{
|
||||||
}
|
_PageCount = tmp.PageCount;
|
||||||
public static void Refresh(Document myDocument, DocumentPdf tmp)
|
_DocPdf = tmp.DocPdf;
|
||||||
{
|
_DTS = tmp.DTS;
|
||||||
string key = myDocument.DocID.ToString() + "_" + tmp.DebugStatus.ToString() + "_" + tmp.TopRow.ToString() + "_" + tmp.PageLength.ToString() + "_" + tmp.LeftMargin.ToString() + "_" + tmp.PageWidth.ToString();
|
_UserID = tmp.UserID;
|
||||||
ConvertListToDictionary();
|
_PdfInfoExtension.Refresh(this);
|
||||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
OnChange();// raise an event
|
||||||
foreach (PdfInfo tmpInfo in _CacheByPrimaryKey[key])
|
}
|
||||||
tmpInfo.RefreshFields(tmp);
|
public static PdfInfo Get(int docID, int debugStatus, int topRow, int pageLength, int leftMargin, int pageWidth)
|
||||||
}
|
{
|
||||||
protected virtual void RefreshFields(DocumentPdf tmp)
|
//if (!CanGetObject())
|
||||||
{
|
// throw new System.Security.SecurityException("User not authorized to view a Pdf");
|
||||||
_PageCount = tmp.PageCount;
|
try
|
||||||
_DocPdf = tmp.DocPdf;
|
{
|
||||||
_DTS = tmp.DTS;
|
PdfInfo tmp = GetCachedByPrimaryKey(docID, debugStatus, topRow, pageLength, leftMargin, pageWidth);
|
||||||
_UserID = tmp.UserID;
|
if (tmp == null)
|
||||||
_PdfInfoExtension.Refresh(this);
|
{
|
||||||
OnChange();// raise an event
|
tmp = DataPortal.Fetch<PdfInfo>(new PKCriteria(docID, debugStatus, topRow, pageLength, leftMargin, pageWidth));
|
||||||
}
|
if (tmp.DocID > 0) AddToCache(tmp);
|
||||||
public static PdfInfo Get(int docID, int debugStatus, int topRow, int pageLength, int leftMargin, int pageWidth)
|
}
|
||||||
{
|
if (tmp.ErrorMessage == "No Record Found")
|
||||||
//if (!CanGetObject())
|
{
|
||||||
// throw new System.Security.SecurityException("User not authorized to view a Pdf");
|
tmp.Dispose(); // Clean-up PdfInfo
|
||||||
try
|
tmp = null;
|
||||||
{
|
}
|
||||||
PdfInfo tmp = GetCachedByPrimaryKey(docID, debugStatus, topRow, pageLength, leftMargin, pageWidth);
|
return tmp;
|
||||||
if (tmp == null)
|
}
|
||||||
{
|
catch (Exception ex)
|
||||||
tmp = DataPortal.Fetch<PdfInfo>(new PKCriteria(docID, debugStatus, topRow, pageLength, leftMargin, pageWidth));
|
{
|
||||||
if (tmp.DocID > 0) AddToCache(tmp);
|
throw new DbCslaException("Error on PdfInfo.Get", ex);
|
||||||
}
|
}
|
||||||
if (tmp.ErrorMessage == "No Record Found")
|
}
|
||||||
{
|
#endregion
|
||||||
tmp.Dispose(); // Clean-up PdfInfo
|
#region Data Access Portal
|
||||||
tmp = null;
|
internal PdfInfo(SafeDataReader dr)
|
||||||
}
|
{
|
||||||
return tmp;
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PdfInfo.Constructor", GetHashCode());
|
||||||
}
|
try
|
||||||
catch (Exception ex)
|
{
|
||||||
{
|
ReadData(dr);
|
||||||
throw new DbCslaException("Error on PdfInfo.Get", ex);
|
}
|
||||||
}
|
catch (Exception ex)
|
||||||
}
|
{
|
||||||
#endregion
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("PdfInfo.Constructor", ex);
|
||||||
#region Data Access Portal
|
throw new DbCslaException("PdfInfo.Constructor", ex);
|
||||||
internal PdfInfo(SafeDataReader dr)
|
}
|
||||||
{
|
}
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PdfInfo.Constructor", GetHashCode());
|
[Serializable()]
|
||||||
try
|
protected class PKCriteria
|
||||||
{
|
{
|
||||||
ReadData(dr);
|
private int _DocID;
|
||||||
}
|
public int DocID
|
||||||
catch (Exception ex)
|
{ get { return _DocID; } }
|
||||||
{
|
private int _DebugStatus;
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("PdfInfo.Constructor", ex);
|
public int DebugStatus
|
||||||
throw new DbCslaException("PdfInfo.Constructor", ex);
|
{ get { return _DebugStatus; } }
|
||||||
}
|
private int _TopRow;
|
||||||
}
|
public int TopRow
|
||||||
[Serializable()]
|
{ get { return _TopRow; } }
|
||||||
protected class PKCriteria
|
private int _PageLength;
|
||||||
{
|
public int PageLength
|
||||||
private int _DocID;
|
{ get { return _PageLength; } }
|
||||||
public int DocID
|
private int _LeftMargin;
|
||||||
{ get { return _DocID; } }
|
public int LeftMargin
|
||||||
private int _DebugStatus;
|
{ get { return _LeftMargin; } }
|
||||||
public int DebugStatus
|
private int _PageWidth;
|
||||||
{ get { return _DebugStatus; } }
|
public int PageWidth
|
||||||
private int _TopRow;
|
{ get { return _PageWidth; } }
|
||||||
public int TopRow
|
public PKCriteria(int docID, int debugStatus, int topRow, int pageLength, int leftMargin, int pageWidth)
|
||||||
{ get { return _TopRow; } }
|
{
|
||||||
private int _PageLength;
|
_DocID = docID;
|
||||||
public int PageLength
|
_DebugStatus = debugStatus;
|
||||||
{ get { return _PageLength; } }
|
_TopRow = topRow;
|
||||||
private int _LeftMargin;
|
_PageLength = pageLength;
|
||||||
public int LeftMargin
|
_LeftMargin = leftMargin;
|
||||||
{ get { return _LeftMargin; } }
|
_PageWidth = pageWidth;
|
||||||
private int _PageWidth;
|
}
|
||||||
public int PageWidth
|
}
|
||||||
{ get { return _PageWidth; } }
|
private void ReadData(SafeDataReader dr)
|
||||||
public PKCriteria(int docID, int debugStatus, int topRow, int pageLength, int leftMargin, int pageWidth)
|
{
|
||||||
{
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PdfInfo.ReadData", GetHashCode());
|
||||||
_DocID = docID;
|
try
|
||||||
_DebugStatus = debugStatus;
|
{
|
||||||
_TopRow = topRow;
|
_DocID = dr.GetInt32("DocID");
|
||||||
_PageLength = pageLength;
|
_DebugStatus = dr.GetInt32("DebugStatus");
|
||||||
_LeftMargin = leftMargin;
|
_TopRow = dr.GetInt32("TopRow");
|
||||||
_PageWidth = pageWidth;
|
_PageLength = dr.GetInt32("PageLength");
|
||||||
}
|
_LeftMargin = dr.GetInt32("LeftMargin");
|
||||||
}
|
_PageWidth = dr.GetInt32("PageWidth");
|
||||||
private void ReadData(SafeDataReader dr)
|
_PageCount = dr.GetDouble("PageCount");
|
||||||
{
|
_DocPdf = (byte[])dr.GetValue("DocPdf");
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PdfInfo.ReadData", GetHashCode());
|
_DTS = dr.GetDateTime("DTS");
|
||||||
try
|
_UserID = dr.GetString("UserID");
|
||||||
{
|
}
|
||||||
_DocID = dr.GetInt32("DocID");
|
catch (Exception ex)
|
||||||
_DebugStatus = dr.GetInt32("DebugStatus");
|
{
|
||||||
_TopRow = dr.GetInt32("TopRow");
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("PdfInfo.ReadData", ex);
|
||||||
_PageLength = dr.GetInt32("PageLength");
|
_ErrorMessage = ex.Message;
|
||||||
_LeftMargin = dr.GetInt32("LeftMargin");
|
throw new DbCslaException("PdfInfo.ReadData", ex);
|
||||||
_PageWidth = dr.GetInt32("PageWidth");
|
}
|
||||||
_PageCount = dr.GetDouble("PageCount");
|
}
|
||||||
_DocPdf = (byte[])dr.GetValue("DocPdf");
|
private void DataPortal_Fetch(PKCriteria criteria)
|
||||||
_DTS = dr.GetDateTime("DTS");
|
{
|
||||||
_UserID = dr.GetString("UserID");
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PdfInfo.DataPortal_Fetch", GetHashCode());
|
||||||
}
|
try
|
||||||
catch (Exception ex)
|
{
|
||||||
{
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("PdfInfo.ReadData", ex);
|
{
|
||||||
_ErrorMessage = ex.Message;
|
ApplicationContext.LocalContext["cn"] = cn;
|
||||||
throw new DbCslaException("PdfInfo.ReadData", ex);
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
}
|
{
|
||||||
}
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
private void DataPortal_Fetch(PKCriteria criteria)
|
cm.CommandText = "getPdf";
|
||||||
{
|
cm.Parameters.AddWithValue("@DocID", criteria.DocID);
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PdfInfo.DataPortal_Fetch", GetHashCode());
|
cm.Parameters.AddWithValue("@DebugStatus", criteria.DebugStatus);
|
||||||
try
|
cm.Parameters.AddWithValue("@TopRow", criteria.TopRow);
|
||||||
{
|
cm.Parameters.AddWithValue("@PageLength", criteria.PageLength);
|
||||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
cm.Parameters.AddWithValue("@LeftMargin", criteria.LeftMargin);
|
||||||
{
|
cm.Parameters.AddWithValue("@PageWidth", criteria.PageWidth);
|
||||||
ApplicationContext.LocalContext["cn"] = cn;
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
using (SqlCommand cm = cn.CreateCommand())
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
{
|
{
|
||||||
cm.CommandType = CommandType.StoredProcedure;
|
if (!dr.Read())
|
||||||
cm.CommandText = "getPdf";
|
{
|
||||||
cm.Parameters.AddWithValue("@DocID", criteria.DocID);
|
_ErrorMessage = "No Record Found";
|
||||||
cm.Parameters.AddWithValue("@DebugStatus", criteria.DebugStatus);
|
return;
|
||||||
cm.Parameters.AddWithValue("@TopRow", criteria.TopRow);
|
}
|
||||||
cm.Parameters.AddWithValue("@PageLength", criteria.PageLength);
|
ReadData(dr);
|
||||||
cm.Parameters.AddWithValue("@LeftMargin", criteria.LeftMargin);
|
}
|
||||||
cm.Parameters.AddWithValue("@PageWidth", criteria.PageWidth);
|
}
|
||||||
cm.CommandTimeout = Database.DefaultTimeout;
|
// removing of item only needed for local data portal
|
||||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
||||||
{
|
ApplicationContext.LocalContext.Remove("cn");
|
||||||
if (!dr.Read())
|
}
|
||||||
{
|
}
|
||||||
_ErrorMessage = "No Record Found";
|
catch (Exception ex)
|
||||||
return;
|
{
|
||||||
}
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("PdfInfo.DataPortal_Fetch", ex);
|
||||||
ReadData(dr);
|
_ErrorMessage = ex.Message;
|
||||||
}
|
throw new DbCslaException("PdfInfo.DataPortal_Fetch", ex);
|
||||||
}
|
}
|
||||||
// removing of item only needed for local data portal
|
}
|
||||||
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
#endregion
|
||||||
ApplicationContext.LocalContext.Remove("cn");
|
// Standard Refresh
|
||||||
}
|
#region extension
|
||||||
}
|
PdfInfoExtension _PdfInfoExtension = new PdfInfoExtension();
|
||||||
catch (Exception ex)
|
[Serializable()]
|
||||||
{
|
partial class PdfInfoExtension : extensionBase { }
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("PdfInfo.DataPortal_Fetch", ex);
|
[Serializable()]
|
||||||
_ErrorMessage = ex.Message;
|
class extensionBase
|
||||||
throw new DbCslaException("PdfInfo.DataPortal_Fetch", ex);
|
{
|
||||||
}
|
// Default Refresh
|
||||||
}
|
public virtual void Refresh(PdfInfo tmp) { }
|
||||||
#endregion
|
}
|
||||||
// Standard Refresh
|
#endregion
|
||||||
#region extension
|
} // Class
|
||||||
PdfInfoExtension _PdfInfoExtension = new PdfInfoExtension();
|
#region Converter
|
||||||
[Serializable()]
|
internal class PdfInfoConverter : ExpandableObjectConverter
|
||||||
partial class PdfInfoExtension : extensionBase { }
|
{
|
||||||
[Serializable()]
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
class extensionBase
|
{
|
||||||
{
|
if (destType == typeof(string) && value is PdfInfo)
|
||||||
// Default Refresh
|
{
|
||||||
public virtual void Refresh(PdfInfo tmp) { }
|
// Return the ToString value
|
||||||
}
|
return ((PdfInfo)value).ToString();
|
||||||
#endregion
|
}
|
||||||
} // Class
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
#region Converter
|
}
|
||||||
internal class PdfInfoConverter : ExpandableObjectConverter
|
}
|
||||||
{
|
#endregion
|
||||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
|
||||||
{
|
|
||||||
if (destType == typeof(string) && value is PdfInfo)
|
|
||||||
{
|
|
||||||
// Return the ToString value
|
|
||||||
return ((PdfInfo)value).ToString();
|
|
||||||
}
|
|
||||||
return base.ConvertTo(context, culture, value, destType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user