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:
2016-01-20 16:43:23 +00:00
parent 77cdf81736
commit 6366af8b47
17 changed files with 1132 additions and 243 deletions

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using DescriptiveEnum;
using System.Xml;
namespace VEPROMS.CSLA.Library
{
@@ -875,6 +876,45 @@ namespace VEPROMS.CSLA.Library
}
set { _MyEnhancedDocuments = value; }
}
public void AddEnhancedDocument(int type, int itemid)
{
MyEnhancedDocuments.Add(type, itemid);
SaveEnhancedDocuments();
}
public void SaveEnhancedDocuments()
{
// 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.
EnhancedDocuments edsToAdd = new EnhancedDocuments();
foreach (EnhancedDocument 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"))
{
//EnhancedDocument tmp = edsToAdd[int.Parse(xn.Attributes["Type"].Value)];
EnhancedDocument tmp = edsToAdd.GetByType(int.Parse(xn.Attributes["Type"].Value)); // [int.Parse(xn.Attributes["Type"].Value)];
if (tmp != null)
{
if (int.Parse(xn.Attributes["ItemID"].Value) != tmp.ItemID)
xn.Attributes["ItemID"].Value = tmp.ItemID.ToString();
edsToAdd.Remove(tmp);
}
}
foreach (EnhancedDocument 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();
}
}
#endregion
#region IItemConfig Members