Enhanced Document support
Null check Move DisplayText.cs to CSLA Enhanced Documents – don’t allow ‘Save’ RO on enhanced step Enhanced Documents windowing Enhanced Documents remove unnecessary options Enhanced Documents – don’t allow ‘Save’ transition on enhanced step Enhanced Documents/Insert,Delete,Paste
This commit is contained in:
@@ -28,14 +28,11 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
return eds;
|
||||
}
|
||||
public DVEnhancedDocument this[int type]
|
||||
public DVEnhancedDocument GetByType(int type)
|
||||
{
|
||||
get
|
||||
{
|
||||
foreach (DVEnhancedDocument ed in this)
|
||||
if (ed.Type == type) return ed;
|
||||
return null;
|
||||
}
|
||||
foreach (DVEnhancedDocument ed in this)
|
||||
if (ed.Type == type) return ed;
|
||||
return null;
|
||||
}
|
||||
public DVEnhancedDocument this[string name]
|
||||
{
|
||||
@@ -46,6 +43,15 @@ namespace VEPROMS.CSLA.Library
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public bool HasSourcePointer
|
||||
{
|
||||
get
|
||||
{
|
||||
foreach (DVEnhancedDocument ed in this)
|
||||
if (ed.Type == 0) return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
public partial class DVEnhancedDocument
|
||||
{
|
||||
@@ -86,7 +92,7 @@ namespace VEPROMS.CSLA.Library
|
||||
Type = type;
|
||||
VersionID = versionID;
|
||||
PdfX = pdfX;
|
||||
PdfToken = PdfToken;
|
||||
PdfToken = pdfToken;
|
||||
}
|
||||
public override string ToString()
|
||||
{
|
||||
@@ -110,6 +116,49 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
set { _MyEnhancedDocuments = value; }
|
||||
}
|
||||
public void SaveDVEnhancedDocuments()
|
||||
{
|
||||
// get all of the current enhanced links from datastructure in code. This list may have been
|
||||
// modified by adding items during code execution by associating source <--> background etc.
|
||||
DVEnhancedDocuments edsToAdd = new DVEnhancedDocuments();
|
||||
foreach (DVEnhancedDocument ed in MyEnhancedDocuments)
|
||||
edsToAdd.Add(ed);
|
||||
|
||||
// from the existing list in xml, remove any that are in the 'editted (edsToAdd) list
|
||||
// so that what remains are those that need added to xml that will then be written to database
|
||||
foreach (XmlNode xn in _Xp.XmlContents.SelectNodes("//Enhanced"))
|
||||
{
|
||||
DVEnhancedDocument tmp = edsToAdd.GetByType(int.Parse(xn.Attributes["Type"].Value));
|
||||
if (tmp != null)
|
||||
{
|
||||
if (xn.Attributes["Name"].Value != tmp.Name)
|
||||
xn.Attributes["Name"].Value = tmp.Name;
|
||||
if (int.Parse(xn.Attributes["Type"].Value) != tmp.Type)
|
||||
xn.Attributes["Type"].Value = tmp.Type.ToString();
|
||||
if (int.Parse(xn.Attributes["VersionID"].Value) != tmp.VersionID)
|
||||
xn.Attributes["VersionID"].Value = tmp.VersionID.ToString();
|
||||
if (int.Parse(xn.Attributes["PdfX"].Value) != tmp.PdfX)
|
||||
xn.Attributes["PdfX"].Value = tmp.PdfX.ToString();
|
||||
if (xn.Attributes["PdfToken"].Value != tmp.PdfToken)
|
||||
xn.Attributes["PdfToken"].Value = tmp.PdfToken;
|
||||
edsToAdd.Remove(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
// WILL NEED THIS FOR New/ADD
|
||||
//foreach (DVEnhancedDocument edadd in edsToAdd)
|
||||
//{
|
||||
// // Add (example): <Enhanced Type="Background" ItemID="43138" /><Enhanced Type="Deviation" ItemID="67165" />
|
||||
// // First add 'Enhanced' element:
|
||||
// XmlNode newEnhNode = _Xp.XmlContents.CreateNode(XmlNodeType.Element, "Enhanced", _Xp.XmlContents.NamespaceURI);
|
||||
// XmlNode xnEnh = _Xp.XmlContents.DocumentElement.AppendChild(newEnhNode);
|
||||
// // Now add the 'Type' and 'ItemID' attributes:
|
||||
// XmlAttribute xa = xnEnh.Attributes.Append(_Xp.XmlContents.CreateAttribute("Type"));
|
||||
// xa.Value = edadd.Type.ToString();
|
||||
// xa = xnEnh.Attributes.Append(_Xp.XmlContents.CreateAttribute("ItemID"));
|
||||
// xa.Value = edadd.ItemID.ToString();
|
||||
//}
|
||||
}
|
||||
#region DynamicTypeDescriptor
|
||||
internal override bool IsReadOnly
|
||||
{
|
||||
|
Reference in New Issue
Block a user