C2018-039: Upgrade – User Control of Format

This commit is contained in:
Kathy Ruffing 2018-12-12 15:34:25 +00:00
parent ddf01e9f9a
commit bbcb638024
29 changed files with 4656 additions and 133 deletions

View File

@ -1357,9 +1357,322 @@ namespace VEPROMS.CSLA.Library
}
}
#endregion
#region Enhanced
#region Enhanced_UnlinkItems
[Serializable()]
#region UCF Fix FormatId After Import
private class FixFormatIDAfterImportCriteria
{
private string _DocVersionList;
public string DocVersionList
{
get { return _DocVersionList; }
set { _DocVersionList = value; }
}
private int _OldFormatID;
public int OldFormatID
{
get { return _OldFormatID; }
set { _OldFormatID = value; }
}
private int _NewFormatID;
public int NewFormatID
{
get { return _NewFormatID; }
set { _NewFormatID = value; }
}
public FixFormatIDAfterImportCriteria(string dvlst, int oldfid, int newfid)
{
_DocVersionList = dvlst;
_OldFormatID = oldfid;
_NewFormatID = newfid;
}
}
private void DataPortal_Fetch(FixFormatIDAfterImportCriteria criteria)
{
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "vesp_UpdateVersionFormatForUCF";
cm.Parameters.AddWithValue("@VersionList", criteria.DocVersionList);
cm.Parameters.AddWithValue("@OldFormatID", criteria.OldFormatID);
cm.Parameters.AddWithValue("@NewFormatID", criteria.NewFormatID);
cm.CommandTimeout = Database.DefaultTimeout;
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
IsReadOnly = false;
while (dr.Read())
{
ContentInfo contentInfo = new ContentInfo(dr);
this.Add(contentInfo);
}
IsReadOnly = true;
}
}
}
}
catch (Exception ex)
{
Database.LogException("FixFormatIDAfterImport.DataPortal_Fetch", ex);
throw new DbCslaException("FixFormatIDAfterImport.DataPortal_Fetch", ex);
}
}
public static ContentInfoList FixFormatIDAfterImport(string dvlst, int oldfid, int newfid)
{
try
{
ContentInfoList tmp = DataPortal.Fetch<ContentInfoList>(new FixFormatIDAfterImportCriteria(dvlst, oldfid, newfid));
return tmp;
}
catch (Exception ex)
{
throw new DbCslaException("Error on ContentInfoList.FixFormatIDAfterImport", ex);
}
}
#endregion
#region UCF Clear Overwridden Formats
private class ClearOverrideFormatsByFolderCriteria
{
public ClearOverrideFormatsByFolderCriteria(int folderID, int? formatID, int? newformatID)
{
_FormatID = formatID;
_FolderID = folderID;
_NewFormatID = newformatID;
}
private int? _FormatID;
public int? FormatID
{
get { return _FormatID; }
set { _FormatID = value; }
}
private int? _NewFormatID;
public int? NewFormatID
{
get { return _NewFormatID; }
set { _NewFormatID = value; }
}
private int _FolderID;
public int FolderID
{
get { return _FolderID; }
set { _FolderID = value; }
}
}
private void DataPortal_Fetch(ClearOverrideFormatsByFolderCriteria criteria)
{
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "vesp_ClearOverrideFormatsByFolder";
cm.Parameters.AddWithValue("@FolderID", criteria.FolderID);
if (criteria.FormatID == null)
cm.Parameters.AddWithValue("@FormatID", DBNull.Value);
else
cm.Parameters.AddWithValue("@FormatID", criteria.FormatID);
if (criteria.NewFormatID == null)
cm.Parameters.AddWithValue("@NewFormatID", DBNull.Value);
else
cm.Parameters.AddWithValue("@NewFormatID", criteria.NewFormatID);
cm.CommandTimeout = Database.DefaultTimeout;
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
IsReadOnly = false;
while (dr.Read())
{
ContentInfo contentInfo = new ContentInfo(dr);
this.Add(contentInfo);
}
IsReadOnly = true;
}
}
}
}
catch (Exception ex)
{
Database.LogException("ClearOverrideFormatsByFolderCriteria.DataPortal_Fetch", ex);
throw new DbCslaException("ClearOverrideFormatsByFolderCriteria.DataPortal_Fetch", ex);
}
}
public static ContentInfoList ClearOverrideFormatsByFolder(int folderID, int? formatID, int? newformatID)
{
try
{
ContentInfoList tmp = DataPortal.Fetch<ContentInfoList>(new ClearOverrideFormatsByFolderCriteria(folderID, formatID, newformatID));
return tmp;
}
catch (Exception ex)
{
throw new DbCslaException("Error on ContentInfoList.ClearOverrideFormatsByFolder", ex);
}
}
private class ClearOverrideFormatsByDocVersionCriteria
{
public ClearOverrideFormatsByDocVersionCriteria(string dvlist, int? formatID, int?newformatID)
{
_FormatID = formatID;
_DVList = dvlist;
_NewFormatID = newformatID;
}
private int? _FormatID;
public int? FormatID
{
get { return _FormatID; }
set { _FormatID = value; }
}
private int? _NewFormatID;
public int? NewFormatID
{
get { return _NewFormatID; }
set { _NewFormatID = value; }
}
private string _DVList;
public string DVList
{
get { return _DVList; }
set { _DVList = value; }
}
}
private void DataPortal_Fetch(ClearOverrideFormatsByDocVersionCriteria criteria)
{
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "vesp_ClearOverrideFormatsByDocVersion";
cm.Parameters.AddWithValue("@DocVersionList", criteria.DVList);
if (criteria.FormatID == null)
cm.Parameters.AddWithValue("@FormatID", DBNull.Value);
else
cm.Parameters.AddWithValue("@FormatID", criteria.FormatID);
if (criteria.NewFormatID == null)
cm.Parameters.AddWithValue("@NewFormatID", DBNull.Value);
else
cm.Parameters.AddWithValue("@NewFormatID", criteria.NewFormatID);
cm.CommandTimeout = Database.DefaultTimeout;
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
IsReadOnly = false;
while (dr.Read())
{
ContentInfo contentInfo = new ContentInfo(dr);
this.Add(contentInfo);
}
IsReadOnly = true;
}
}
}
}
catch (Exception ex)
{
Database.LogException("ClearOverrideFormatsByDocVersion.DataPortal_Fetch", ex);
throw new DbCslaException("ClearOverrideFormatsByDocVersion.DataPortal_Fetch", ex);
}
}
public static ContentInfoList ClearOverrideFormatsByDocVersion(string dvlist, int? formatID, int? newformatID)
{
try
{
ContentInfoList tmp = DataPortal.Fetch<ContentInfoList>(new ClearOverrideFormatsByDocVersionCriteria(dvlist, formatID, newformatID));
return tmp;
}
catch (Exception ex)
{
throw new DbCslaException("Error on ContentInfoList.ClearOverrideFormatsByDocVersion", ex);
}
}
private class ClearOverrideFormatsByItemCriteria
{
public ClearOverrideFormatsByItemCriteria(int itemID, int? formatID, int? newformatID)
{
_FormatID = formatID;
_NewFormatID = newformatID;
_ItemID = itemID;
}
private int? _FormatID;
public int? FormatID
{
get { return _FormatID; }
set { _FormatID = value; }
}
private int? _NewFormatID;
public int? NewFormatID
{
get { return _NewFormatID; }
set { _NewFormatID = value; }
}
private int _ItemID;
public int ItemID
{
get { return _ItemID; }
set { _ItemID = value; }
}
}
private void DataPortal_Fetch(ClearOverrideFormatsByItemCriteria criteria)
{
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "vesp_ClearOverrideFormatsByItem";
cm.Parameters.AddWithValue("@ItemID", criteria.ItemID);
if (criteria.FormatID == null)
cm.Parameters.AddWithValue("@FormatID", DBNull.Value);
else
cm.Parameters.AddWithValue("@FormatID", criteria.FormatID);
if (criteria.NewFormatID == null)
cm.Parameters.AddWithValue("@NewFormatID", DBNull.Value);
else
cm.Parameters.AddWithValue("@NewFormatID", criteria.NewFormatID);
cm.CommandTimeout = Database.DefaultTimeout;
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
IsReadOnly = false;
while (dr.Read())
{
ContentInfo contentInfo = new ContentInfo(dr);
this.Add(contentInfo);
}
IsReadOnly = true;
}
}
}
}
catch (Exception ex)
{
Database.LogException("ClearOverrideFormatsByItem.DataPortal_Fetch", ex);
throw new DbCslaException("ClearOverrideFormatsByItem.DataPortal_Fetch", ex);
}
}
public static ContentInfoList ClearOverrideFormatsByItem(int itemID, int? formatID, int? newformatID)
{
try
{
ContentInfoList tmp = DataPortal.Fetch<ContentInfoList>(new ClearOverrideFormatsByItemCriteria(itemID, formatID, newformatID));
return tmp;
}
catch (Exception ex)
{
throw new DbCslaException("Error on ContentInfoList.ClearOverrideFormatsByItem", ex);
}
}
#endregion
#region Enhanced
#region Enhanced_UnlinkItems
[Serializable()]
private class EnhancedUnlinkCriteria
{
public EnhancedUnlinkCriteria(int? enhancedID)

View File

@ -1936,7 +1936,7 @@ namespace VEPROMS.CSLA.Library
// return Text;
//}
#endregion
private static Dictionary<ReplaceStr, Regex> dicReplaceRegex = new Dictionary<ReplaceStr, Regex>();
private static Dictionary<FormatConfig.ReplaceStr, Regex> dicReplaceRegex = new Dictionary<FormatConfig.ReplaceStr, Regex>();
private static bool? _ProcessReplaceWords;
public static bool ProcessReplaceWords
{
@ -1961,33 +1961,33 @@ namespace VEPROMS.CSLA.Library
if (_MyItemInfo.MyContent.Type < 20000) return Text; // for now only replace in steps.
FoundMatches myMatches = new FoundMatches(Text,_MyItemInfo.FormatStepData.Font,_MyItemInfo);
// Exclude Link Text from Replace Word process
myMatches.AddLink(regFindLink, _MyFormat.PlantFormat.FormatData.SectData.ReplaceWordsInROs, _MyItemInfo.MyProcedure.MyDocVersion);
ReplaceStrList rsl = _MyFormat.PlantFormat.FormatData.SectData.ReplaceStrList;
myMatches.AddLink(regFindLink, _MyFormat.PlantFormat.FormatData.SectData.ReplaceWordsInROs, _MyItemInfo.MyProcedure.MyDocVersion);
FormatConfig.ReplaceStrData rsl = _MyFormat.PlantFormat.UCFandOrigReplaceStrData;
// ReplaceStrData xml node is empty, it does the inheritance and gets the 'base' format's list.
if (rsl.Count==1 && (rsl[0].ReplaceWord == null || rsl[0].ReplaceWord == "")) return Text;
// Loop through text looking for words to be replaced
Dictionary<ReplaceStr, Regex> partialReplaceList = new Dictionary<ReplaceStr, Regex>();
Dictionary<FormatConfig.ReplaceStr, Regex> partialReplaceList = new Dictionary<FormatConfig.ReplaceStr, Regex>();
Dictionary<E_ReplaceFlags?, bool> shouldReplace = new Dictionary<E_ReplaceFlags?, bool>();
//int profileDepth = ProfileTimer.Push(">>>> DoReplaceWords2.ForLoop");
foreach (ReplaceStr rs in rsl)
foreach (FormatConfig.ReplaceStr rs in rsl)
{
bool dopartial = (rs.Flag & E_ReplaceFlags.Partials) == E_ReplaceFlags.Partials;
bool dopartial = (E_ReplaceFlags)(rs.Flag & FormatConfig.E_ReplaceFlagsUCF.Partials) == E_ReplaceFlags.Partials;
// note that the order of this check is important. Check in this order...
// background here
if (!shouldReplace.ContainsKey(rs.Flag))
if (!shouldReplace.ContainsKey((E_ReplaceFlags)rs.Flag))
{
//int profileDepth2 = ProfileTimer.Push(">>>> Before ShouldReplaceIt");
shouldReplace.Add(rs.Flag, ShouldReplaceIt(rs.Flag));
shouldReplace.Add((E_ReplaceFlags)rs.Flag, ShouldReplaceIt((E_ReplaceFlags)rs.Flag));
//ProfileTimer.Pop(profileDepth2);
}
bool replaceit = shouldReplace[rs.Flag];
bool replaceit = shouldReplace[(E_ReplaceFlags)rs.Flag];
if (replaceit)
{
if (!dicReplaceRegex.ContainsKey(rs))
{
RegexOptions myOptions = (rs.Flag & E_ReplaceFlags.CaseInsens) == E_ReplaceFlags.CaseInsens ? RegexOptions.IgnoreCase : RegexOptions.None;
RegexOptions myOptions = (E_ReplaceFlags)(rs.Flag & FormatConfig.E_ReplaceFlagsUCF.CaseInsens) == E_ReplaceFlags.CaseInsens ? RegexOptions.IgnoreCase : RegexOptions.None;
if (dopartial)
{
dicReplaceRegex.Add(rs, new Regex(rs.ReplaceWord, myOptions));
@ -2028,8 +2028,8 @@ namespace VEPROMS.CSLA.Library
Text = Text.Replace(@"\xA0", @"\u160?"); //replace hard space
try
{
foreach (ReplaceStr prs in partialReplaceList.Keys)
Text = partialReplaceList[prs].Replace(Text, prs.ReplaceWith);
foreach (FormatConfig.ReplaceStr prs in partialReplaceList.Keys)
Text = partialReplaceList[prs].Replace(Text, prs.ReplaceWith);
}
catch (Exception ex) // Don't crash on a format issue.
{
@ -2184,7 +2184,7 @@ namespace VEPROMS.CSLA.Library
_Font = font;
_MyItemInfo = myItemInfo;
}
public void Add(Regex myRegEx, ReplaceStr myWord)
public void Add(Regex myRegEx, FormatConfig.ReplaceStr myWord)
{
MatchCollection myMatches = myRegEx.Matches(_Text);
foreach (Match myMatch in myMatches)
@ -2227,7 +2227,7 @@ namespace VEPROMS.CSLA.Library
}
return false;
}
public void Add(Match myMatch, ReplaceStr myWord)
public void Add(Match myMatch, FormatConfig.ReplaceStr myWord)
{
// If one already exists for this location, then don't add another.
if (ContainsKey(myMatch.Index)) return;
@ -2262,9 +2262,9 @@ namespace VEPROMS.CSLA.Library
{
//if(offset != 0 || foundMatch.MyMatch.Index != 0 || !foundMatch.MyWord.ReplaceWith.StartsWith(@"{\par}"))
//{
if (((foundMatch.MyWord.Flag & E_ReplaceFlags.DiffUnit) == 0) || DiffUnit(foundMatch.MyWord.ReplaceWord,_MyItemInfo,"UNIT "))
if (((foundMatch.MyWord.Flag & FormatConfig.E_ReplaceFlagsUCF.DiffUnit) == 0) || DiffUnit(foundMatch.MyWord.ReplaceWord,_MyItemInfo,"UNIT "))
{
string with = foundMatch.MyWord.ReplaceWith;
string with = foundMatch.MyWord.ReplaceWith;
if (offset == 0 && with.StartsWith(@"{\par}"))
if(StartsWith(text,foundMatch.MyMatch.Index,"",@"\ul ",@"\b ",@"* ",@"* \ul ",@"* \b ",@"*",@"*\ul ",@"*\b "))
with = with.Replace(@"{\par}", "");
@ -2365,13 +2365,13 @@ namespace VEPROMS.CSLA.Library
get { return _MyMatch; }
set { _MyMatch = value; }
}
private ReplaceStr _MyWord;
public ReplaceStr MyWord
private FormatConfig.ReplaceStr _MyWord;
public FormatConfig.ReplaceStr MyWord
{
get { return _MyWord; }
set { _MyWord = value; }
}
public FoundMatch(Match myMatch, ReplaceStr myWord)
public FoundMatch(Match myMatch, FormatConfig.ReplaceStr myWord)
{
_MyMatch = myMatch;
_MyWord = myWord;

View File

@ -140,7 +140,7 @@ namespace VEPROMS.CSLA.Library
[NonSerialized]
private PlantFormat _PlantFormat;
public PlantFormat PlantFormat
{ get { return (_PlantFormat != null ? _PlantFormat : _PlantFormat = new PlantFormat(this)); } }
{ get { return (_PlantFormat != null ? _PlantFormat : _PlantFormat = new PlantFormat(this, Config)); } }
#endregion
public static event FormatEvent FormatLoaded;
private static void OnFormatLoaded(object sender, FormatEventArgs args)
@ -517,11 +517,75 @@ namespace VEPROMS.CSLA.Library
throw new DbCslaException("FormatInfo.DataPortal_Fetch", ex);
}
}
// Get format data, but do not resolve the 'Data' and 'Genmac' fields, i.e. keep empty if they are
// empty.
public static FormatInfo GetFormatNoUCFByFormatID(int formatID)
{
try
{
FormatInfo tmp = DataPortal.Fetch<FormatInfo>(new FormatIDNoUCFCriteria(formatID));
if (tmp.ErrorMessage == "No Record Found")
{
tmp.Dispose(); // Clean-up FormatInfo
tmp = null;
}
return tmp;
}
catch (Exception ex)
{
throw new DbCslaException("Error on FormatInfo.GetFormatNoUCFByFormatID", ex);
}
}
protected class FormatIDNoUCFCriteria
{
private int _FormatID;
public int FormatID { get { return _FormatID; } }
public FormatIDNoUCFCriteria(int formatID)
{
_FormatID = formatID;
}
}
private void DataPortal_Fetch(FormatIDNoUCFCriteria criteria)
{
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FormatInfo.DataPortal_Fetch", GetHashCode());
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
ApplicationContext.LocalContext["cn"] = cn;
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "getFormatNoUCF";
cm.Parameters.AddWithValue("@FormatID", criteria.FormatID);
cm.CommandTimeout = Database.DefaultTimeout;
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
if (!dr.Read())
{
_ErrorMessage = "No Record Found";
return;
}
ReadData(dr);
}
}
// 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("FormatInfo.DataPortal_Fetch", ex);
_ErrorMessage = ex.Message;
throw new DbCslaException("FormatInfo.DataPortal_Fetch", ex);
}
}
#region PlantFormat
[NonSerialized]
private PlantFormat _PlantFormat;
public PlantFormat PlantFormat
{ get { return (_PlantFormat != null ? _PlantFormat : _PlantFormat = new PlantFormat(this)); } }
{ get { return (_PlantFormat != null ? _PlantFormat : _PlantFormat = new PlantFormat(this, Config)); } }
#endregion
public IFormatOrFormatInfo MyIParent { get { return MyParent; } }
public override string ToString()
@ -608,6 +672,51 @@ namespace VEPROMS.CSLA.Library
return _SortedFormatInfoList;
}
}
public static FormatInfoList GetFormatInfoListUsed()
{
try
{
FormatInfoList fvl = (FormatInfoList)DataPortal.Fetch(new FormatInfoListUsedCriteria());
return fvl;
}
catch (Exception ex)
{
throw new DbCslaException("FormatVersionList.DataPortal_Fetch GetFormatVersions", ex);
}
}
protected class FormatInfoListUsedCriteria
{
}
private void DataPortal_Fetch(FormatInfoListUsedCriteria criteria)
{
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "getFormatListUsed";
cm.CommandTimeout = Database.DefaultTimeout;
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
while (dr.Read())
{
FormatInfo formatInfo = new FormatInfo(dr);
IsReadOnly = false;
this.Add(formatInfo);
IsReadOnly = true;
}
}
}
}
}
catch (Exception ex)
{
Database.LogException("FormatInfoList.DataPortal_Fetch", ex);
throw new DbCslaException("FormatInfoList.DataPortal_Fetch", ex);
}
}
}
public class FormatVersion
{

View File

@ -5185,7 +5185,8 @@ namespace VEPROMS.CSLA.Library
// To determine if the section has a checkoff...
// Section won't have checkoffs if there is no checkofflist, or
ProcData pd = ActiveFormat.PlantFormat.FormatData.ProcData;
if (pd.CheckOffData == null || pd.CheckOffData.CheckOffList == null || pd.CheckOffData.CheckOffList.MaxIndex <= 0) return false;
int maxindx = pd.CheckOffUCF ? pd.CheckOffData.CheckOffList.MaxIndex : pd.CheckOffData.CheckOffList.MaxIndexNoInherit;
if (pd.CheckOffData == null || pd.CheckOffData.CheckOffList == null || maxindx <= 0) return false;
if (pd.CheckOffData.CheckOffHeaderList == null || pd.CheckOffData.CheckOffHeaderList.MaxIndex <= 1) return true;
//if (pd.CheckOffData == null || pd.CheckOffData.CheckOffHeaderList == null || pd.CheckOffData.CheckOffHeaderList.Count <= 1) return false;
@ -5216,7 +5217,8 @@ namespace VEPROMS.CSLA.Library
private int SectionDefaultCheckOffIndex()
{
ProcData pd = ActiveFormat.PlantFormat.FormatData.ProcData;
if (pd.CheckOffData != null && pd.CheckOffData.CheckOffList != null && pd.CheckOffData.CheckOffList.MaxIndex == 2) return 0; // if only two items, first is macro - use it.
int maxindx = pd.CheckOffUCF ? pd.CheckOffData.CheckOffList.MaxIndex : pd.CheckOffData.CheckOffList.MaxIndexNoInherit;
if (pd.CheckOffData != null && pd.CheckOffData.CheckOffList != null && maxindx == 2) return 0; // if only two items, first is macro - use it.
SectionConfig sc = ActiveSection.MyConfig as SectionConfig;
return sc.Section_CheckoffListSelection;
}
@ -5227,7 +5229,23 @@ namespace VEPROMS.CSLA.Library
if (!SectionHasCheckOffs()) return null;
int stpCoIndx = CheckOffIndex(); // this step has a checkoff defined
if (stpCoIndx == -1) return null;
if (stpCoIndx > 1) return ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffList[stpCoIndx];
if (stpCoIndx > 1)
{
if (ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffUCF && stpCoIndx >= 100)
{
// get index, if greater than 100, store that - otherwise store index down list.
// if this format does not have ucf signoffs, indx is just the selected index from the combo box.
foreach (CheckOff co in ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffList)
{
if (stpCoIndx == co.Index)
{
stpCoIndx = (int)co.Index;
break;
}
}
}
return ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffList[stpCoIndx]; // DO override of CheckOffList[] to get ucf
}
int sectCoIndx = SectionDefaultCheckOffIndex(); // no checkoff on step, see if there is a section default.
if (sectCoIndx == -1) return null;
if ((ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffOnHLSOnly && IsHigh)
@ -5261,7 +5279,8 @@ namespace VEPROMS.CSLA.Library
get
{
ProcData pd = ActiveFormat.PlantFormat.FormatData.ProcData;
if (pd.CheckOffData != null && pd.CheckOffData.CheckOffList != null && pd.CheckOffData.CheckOffList.MaxIndex == 2 && pd.CheckOffData.CheckOffList[0].MenuItem == "Enabled")
int maxindx = pd.CheckOffUCF ? pd.CheckOffData.CheckOffList.MaxIndex : pd.CheckOffData.CheckOffList.MaxIndexNoInherit;
if (pd.CheckOffData != null && pd.CheckOffData.CheckOffList != null && maxindx == 2 && pd.CheckOffData.CheckOffList[0].MenuItem == "Enabled")
return true; // if only two items, first is macro - use it.
return false;
}

View File

@ -0,0 +1,335 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Windows.Forms;
namespace VEPROMS.CSLA.Library
{
public class Comparator
{
private XmlDocument _ResultsDoc;
public XmlDocument ResultsDoc
{
get { return _ResultsDoc; }
set { _ResultsDoc = value; }
}
private XmlDocument _XDoc1;
public XmlDocument XDoc1
{
get { return _XDoc1; }
set { _XDoc1 = value; }
}
private XmlDocument _XDoc2;
public XmlDocument XDoc2
{
get { return _XDoc2; }
set { _XDoc2 = value; }
}
public Comparator(XmlDocument xdoc1, XmlDocument xdoc2)
{
XDoc1 = xdoc1;
XDoc2 = xdoc2;
ResultsDoc = new XmlDocument();
ResultsDoc.LoadXml(@"<PlantFormat></PlantFormat>");
}
public Comparator(string existingFC, string importedFC) //string fName1, string fName2)
{
XDoc1 = new XmlDocument();
XDoc1.LoadXml(existingFC);
XDoc2 = new XmlDocument();
XDoc2.LoadXml(importedFC);
ResultsDoc = new XmlDocument();
ResultsDoc.LoadXml(@"<PlantFormat></PlantFormat>");
}
public XmlDocument Compare()
{
AllKeys = null;
Compare(XDoc1.DocumentElement, XDoc2.DocumentElement, "");
Console.WriteLine("results xml = \r\n{0}", ResultsDoc.InnerXml);
return ResultsDoc;
}
public void Compare(XmlNode xn1, XmlNode xn2, string path)
{
if (xn1.OuterXml == xn2.OuterXml) return;
Compare(xn1.Attributes, xn2.Attributes , path, xn1, xn2);
xn1.Attributes.RemoveAll();
xn2.Attributes.RemoveAll();
Dictionary<string, XmlNode> xns1 = new Dictionary<string, XmlNode>(); // child nodes, key = 'OuterXml', value = node itself
Dictionary<string, XmlNode> xns2 = new Dictionary<string, XmlNode>();
// xns1 starts out with all child nodes of xn1
foreach (XmlNode xc1 in xn1.ChildNodes)
xns1.Add(xc1.OuterXml + GetKey(xc1), xc1);
// xns1 - remove any matching child nodes from xns2
// xns2 - has nodes that are not in xns1
foreach (XmlNode xc2 in xn2.ChildNodes)
if (xns1.ContainsKey(xc2.OuterXml + GetKey(xc2)))
xns1.Remove(xc2.OuterXml + GetKey(xc2));
else
xns2.Add(xc2.OuterXml+GetKey(xc2), xc2);
// xnss1 & xnss2 are dictionaries based on a unique key
Dictionary<string, XmlNode> xnss1 = new Dictionary<string, XmlNode>();
Dictionary<string, XmlNode> xnss2 = new Dictionary<string, XmlNode>();
foreach (XmlNode xc1 in xns1.Values)
xnss1.Add(GetKey(xc1), xc1);
foreach (XmlNode xc2 in xns2.Values)
if (xnss1.ContainsKey(GetKey(xc2)))
Compare(xnss1[GetKey(xc2)], xc2, path + "/" + GetKey(xc2));
else
xnss2.Add(GetKey(xc2), xc2);
// element differences, if counts are different. xns1 elements are not found in xns2 and xns2 elements are not found in xns1
if (xns1.Count == 0 && xns2.Count == 0) return;
xns1 = new Dictionary<string, XmlNode>(); // child nodes, key = 'OuterXml', value = node itself
xns2 = new Dictionary<string, XmlNode>();
// xns1 starts out with all child nodes of xn1
foreach (XmlNode xc1 in xn1.ChildNodes)
{
xns1.Add(xc1.OuterXml+GetKey(xc1), xc1);
}
// xns1 - remove any matching child nodes from xns2
// xns2 - has nodes that are not in xns1
foreach (XmlNode xc2 in xn2.ChildNodes)
if (xns1.ContainsKey(xc2.OuterXml + GetKey(xc2)))
xns1.Remove(xc2.OuterXml + GetKey(xc2));
else
xns2.Add(xc2.OuterXml + GetKey(xc2), xc2);
// xnss1 & xnss2 are dictionaries based on a unique key
xnss1 = new Dictionary<string, XmlNode>();
xnss2 = new Dictionary<string, XmlNode>();
foreach (XmlNode xc1 in xns1.Values)
xnss1.Add(GetKey(xc1), xc1);
foreach (XmlNode xc2 in xns2.Values)
if (xnss1.ContainsKey(GetKey(xc2)))
Compare(xnss1[GetKey(xc2)], xc2, path + "/" + GetKey(xc2));
else
xnss2.Add(GetKey(xc2), xc2);
// element differences, if counts are different. xns1 elements are not found in xns2 and xns2 elements are not found in xns1
if (xns1.Count == 0 && xns2.Count == 0) return;
Console.WriteLine(" {0} {1} {2}", path + "/" + xn1.Name, xns1.Count, xns2.Count);
foreach (string key in xnss1.Keys)
{
if (xnss1[key].Attributes.Count > 0 || xnss1[key].ChildNodes.Count > 0)
{
XmlNode xnr = MakeXPathFormat(path);
if (xnr != null)
{
XmlNode cloned = xnss1[key].CloneNode(true);
XmlNode importNode = ResultsDoc.ImportNode(cloned, true);
XmlNode resnd = xnr.AppendChild(importNode);
XmlAttribute xKey = ResultsDoc.CreateAttribute("Mode");
xKey.Value = "Deleted";
resnd.Attributes.Append(xKey);
xKey = ResultsDoc.CreateAttribute("OldKey");
xKey.Value = GetKey(xnss1[key]);
resnd.Attributes.Append(xKey);
xnr.AppendChild(resnd);
if (resnd.ChildNodes.Count > 0)
{
foreach (XmlNode cxn in resnd.ChildNodes) if (cxn.Name == "Layout") SuffixAttributes("Old", cxn);
}
}
}
xnss1[key].ParentNode.RemoveChild(xnss1[key]);
}
foreach (string key in xnss2.Keys)
{
if (xnss2[key].Attributes.Count > 0 || xnss2[key].ChildNodes.Count > 0)
{
XmlNode xnr = MakeXPathFormat(path);
if (xnr != null)
{
XmlNode cloned = xnss2[key].CloneNode(true);
XmlNode importNode = ResultsDoc.ImportNode(cloned, true);
XmlNode resnd = xnr.AppendChild(importNode);
// if this has subnodes, add the 'Inserted' mode on them, otherwise, out it on this level
if (resnd.ChildNodes.Count > 0)
{
foreach (XmlNode cxn in resnd.ChildNodes)
{
if (cxn.Name=="Layout") SuffixAttributes("New", cxn);
XmlAttribute xKey = ResultsDoc.CreateAttribute("Mode");
xKey.Value = "Inserted";
if (cxn is XmlText)
resnd.Attributes.Append(xKey);
else
cxn.Attributes.Append(xKey); // crashing here on a flag difference - trying to append this attribute to 'false'.
}
}
else
{
XmlAttribute xKey = ResultsDoc.CreateAttribute("Mode");
xKey.Value = "Inserted";
resnd.Attributes.Append(xKey);
}
XmlAttribute xKey1 = ResultsDoc.CreateAttribute("NewKey");
xKey1.Value = GetKey(xnss2[key]);
resnd.Attributes.Append(xKey1);
xnr.AppendChild(resnd);
}
}
xnss2[key].ParentNode.RemoveChild(xnss2[key]);
}
}
private void SuffixAttributes(string suffix, XmlNode resnd)
{
Dictionary<string, string> renameList = new Dictionary<string, string>();
foreach (XmlAttribute xa in resnd.Attributes) renameList.Add(xa.Name, xa.Value);
foreach (string key in renameList.Keys)
{
resnd.Attributes.RemoveNamedItem(key);
XmlAttribute xKey1 = ResultsDoc.CreateAttribute(key+suffix);
xKey1.Value = renameList[key];
resnd.Attributes.Append(xKey1);
}
}
private Dictionary<XmlNode, string> _AllKeys;
public Dictionary<XmlNode, string> AllKeys
{
get
{
if (_AllKeys == null) _AllKeys = new Dictionary<XmlNode, string>();
return _AllKeys;
}
set { _AllKeys = value; }
}
public string GetKey(XmlNode xn)
{
string key = GetKey1(xn);
if (AllKeys.ContainsKey(xn)) return AllKeys[xn];
AllKeys.Add(xn, key);
return key;
}
// Get unique key, key is a string representing either the name itself or a combination of element name/attribute to make it unique
public string GetKey1(XmlNode xn)
{
if (xn.Attributes == null) return xn.Name;
XmlAttribute xi = xn.Attributes.GetNamedItem("Index") as XmlAttribute;
if (xi != null)
{
XmlAttribute xa = xn.Attributes.GetNamedItem("Name") as XmlAttribute;
if (xa != null) return string.Format("{0}[{1}]", xn.Name, xa.Value);
return string.Format("{0}[{1}]", xn.Name, xi.Value);
}
XmlAttribute xt = xn.Attributes.GetNamedItem("Token") as XmlAttribute;
if(xt != null) return string.Format("{0}[{1}]", xn.Name, xt.Value);
XmlAttribute xw = xn.Attributes.GetNamedItem("ReplaceWord") as XmlAttribute;
if(xw != null) return string.Format("{0}[{1}]", xn.Name, xw.Value);
return xn.Name;
}
static private XmlNode makeXPath(XmlDocument doc, string xpath)
{
xpath = xpath.Replace(@"DocStyle[", @"DocStyle[@Name='");
xpath = xpath.Replace(@"]", "']");
return makeXPath(doc, doc as XmlNode, xpath);
}
static private XmlNode makeXPath(XmlDocument doc, XmlNode parent, string xpath)
{
if (xpath.Contains("DocStyle")) Console.WriteLine("here");
// grab the next node name in the xpath; or return parent if empty
string[] partsOfXPath = xpath.Trim('/').Split('/');
string nextNodeInXPath = partsOfXPath.First();
if (string.IsNullOrEmpty(nextNodeInXPath))
return parent;
XmlNode node = parent.SelectSingleNode(nextNodeInXPath);
if (node == null)
{
if (nextNodeInXPath.Contains("@")) // element with an attribute, create both
{
// make element
string elename = nextNodeInXPath.Substring(0, nextNodeInXPath.IndexOf("@") - 1);
node = parent.AppendChild(doc.CreateElement(elename));
// make attribute
int indx = nextNodeInXPath.IndexOf("@")+1;
string name = nextNodeInXPath.Substring(indx, nextNodeInXPath.IndexOf("=",indx)-indx);
XmlAttribute xKeyd = doc.CreateAttribute(name);
indx = nextNodeInXPath.IndexOf("='",indx)+2;
string value = nextNodeInXPath.Substring(indx,nextNodeInXPath.IndexOf("'", indx) - indx);
xKeyd.Value = nextNodeInXPath.Substring(indx,nextNodeInXPath.IndexOf("'",indx)-indx);
node.Attributes.Append(xKeyd);
}
else
node = parent.AppendChild(doc.CreateElement(nextNodeInXPath));
}
// rejoin the remainder of the array as an xpath expression and recurse
string rest = String.Join("/", partsOfXPath.Skip(1).ToArray());
return makeXPath(doc, node, rest);
}
private XmlNode MakeXPathFormat(string xpath)
{
// first find or make, if not found, the XmlElement within FormatData or DocStyles
Console.WriteLine("path = {0}", xpath);
return makeXPath(ResultsDoc, xpath);
}
#region Attributes
private void Compare(XmlAttributeCollection atts1, XmlAttributeCollection atts2, string path, XmlNode atts1Par, XmlNode atts2Par)
{
// go through attributes in first xml document, see if they exist in the 2nd xml document & are identical attribute
foreach (XmlAttribute xa1 in atts1)
{
XmlAttribute xa2 = atts2.GetNamedItem(xa1.Name) as XmlAttribute;
if (xa2 == null)
{
XmlNode xnr = MakeXPathFormat(path);
if (xnr != null)
{
XmlAttribute xKey = ResultsDoc.CreateAttribute(xa1.Name+"Old");
xKey.Value = xa1.Value;
xnr.Attributes.Append(xKey);
xKey = ResultsDoc.CreateAttribute("OldKey");
xKey.Value = GetKey(atts1Par);
if (xKey.Value != null) xnr.Attributes.Append(xKey);
}
}
else if (xa2.Value != xa1.Value)
{
XmlNode xnr = MakeXPathFormat(path);
if (xnr != null)
{
XmlAttribute xKey = ResultsDoc.CreateAttribute(xa1.Name + "Old");
xKey.Value = xa1.Value;
xnr.Attributes.Append(xKey);
XmlAttribute xKey2 = ResultsDoc.CreateAttribute(xa2.Name + "New");
xKey2.Value = xa2.Value;
xnr.Attributes.Append(xKey2);
xKey = ResultsDoc.CreateAttribute("OldKey");
xKey.Value = GetKey(atts1Par);
if (xKey.Value != null) xnr.Attributes.Append(xKey);
xKey = ResultsDoc.CreateAttribute("NewKey");
xKey.Value = GetKey(atts2Par);
if (xKey.Value != null) xnr.Attributes.Append(xKey);
}
}
}
// go through attributes in 2nd xml document to see if they exist in the first xml document & are identical
foreach (XmlAttribute xa2 in atts2)
{
XmlAttribute xa1 = atts1.GetNamedItem(xa2.Name) as XmlAttribute;
if (xa1 == null)
{
XmlNode xnr = MakeXPathFormat(path);
if (xnr != null)
{
XmlAttribute xKey = ResultsDoc.CreateAttribute(xa2.Name+"New");
xKey.Value = xa2.Value;
xnr.Attributes.Append(xKey);
xKey = ResultsDoc.CreateAttribute("NewKey");
xKey.Value = GetKey(atts2Par);
if (xKey.Value != null) xnr.Attributes.Append(xKey);
}
}
}
}
#endregion
}
}

View File

@ -515,7 +515,29 @@ namespace VEPROMS.CSLA.Library
{
get
{
return LazyLoad(ref _LeftMargin, "@LeftMargin");
if (PlantFormat.IgnoreUCF) return LazyLoad(ref _LeftMargin, "@LeftMargin");
if (MyFormat.PlantFormat.FormatConfig == null) return LazyLoad(ref _LeftMargin, "@LeftMargin");
// see if there is UCF data, need to match the index of the ucf data to that in the original format, and
// also need to check that LeftMargin is not null, since other docstyle data may exist in UCF but not PageLength:
XmlNode par = this.XmlNode.ParentNode;
string indx = null;
XmlElement ele = par as XmlElement;
if (ele.HasAttribute("Index")) indx = ele.GetAttribute("Index");
if (indx == null) return LazyLoad(ref _PageLength, "@LeftMargin");
if (MyFormat.PlantFormat.FormatConfig != null && this.MyFormat.PlantFormat.FormatConfig.PlantFormat.DocStyles != null && MyFormat.PlantFormat.FormatConfig.PlantFormat.DocStyles.Count > 0)
{
foreach (FormatConfig.DocStyle ds in MyFormat.PlantFormat.FormatConfig.PlantFormat.DocStyles)
{
if (indx == ds.Index)
{
float? test = ds.Layout.LeftMargin;
if (test != null) _LeftMargin = new LazyLoad<float?>(ds.Layout.LeftMargin);
break;
}
}
}
return LazyLoad(ref _LeftMargin, "@LeftMargin");
}
}
#endregion
@ -526,10 +548,33 @@ namespace VEPROMS.CSLA.Library
[Description("Length of Page")]
public float? PageLength
{
get
{
return LazyLoad(ref _PageLength, "@PageLength");
}
get
{
if (PlantFormat.IgnoreUCF) return LazyLoad(ref _PageLength, "@PageLength");
if (MyFormat.PlantFormat.FormatConfig == null) return LazyLoad(ref _PageLength, "@PageLength");
// see if there is UCF data, need to match the index of the ucf data to that in the original format, and
// also need to check that PageLength is not null, since other docstyle data may exist in UCF but not PageLength:
XmlNode par = this.XmlNode.ParentNode;
string indx = null;
XmlElement ele = par as XmlElement;
if (ele.HasAttribute("Index")) indx = ele.GetAttribute("Index");
if (indx == null) return LazyLoad(ref _PageLength, "@PageLength");
if (MyFormat.PlantFormat.FormatConfig != null && this.MyFormat.PlantFormat.FormatConfig.PlantFormat.DocStyles != null && MyFormat.PlantFormat.FormatConfig.PlantFormat.DocStyles.Count > 0)
{
foreach (FormatConfig.DocStyle ds in MyFormat.PlantFormat.FormatConfig.PlantFormat.DocStyles)
{
if (indx == ds.Index)
{
float? test = ds.Layout.PageLength;
if (test != null) _PageLength = new LazyLoad<float?>(ds.Layout.PageLength);
break;
}
}
}
return LazyLoad(ref _PageLength, "@PageLength");
}
}
#endregion
#region PageWidth

View File

@ -247,5 +247,13 @@ namespace VEPROMS.CSLA.Library
SupInfoPdfPrint = 2,
Merge = 3
}
public enum E_UCFImportOptions : uint
{
Ignore = 0,
LoadNotUsed = 1,
LoadOnlyImported = 2,
LoadUseAll = 3,
LoadForSetOnly = 4
}
#endregion
}

View File

@ -11,9 +11,56 @@ namespace VEPROMS.CSLA.Library
[TypeConverter(typeof(ExpandableObjectConverter))]
public class PlantFormat
{
public PlantFormat(IFormatOrFormatInfo format)
public PlantFormat(IFormatOrFormatInfo format, string config)
{
_MyFormat = format;
string str = null;
if (format is Format) str = (format as Format).Config;
else if (format is FormatInfo) str = (format as FormatInfo).Config;
if (str != null && str != "") _FormatConfig = FormatConfig.Get(str);
}
private FormatConfig _FormatConfig;
public FormatConfig FormatConfig
{
get
{
if (_FormatConfig == null)
{
_FormatConfig = GetFormatConfig(_MyFormat);
}
return _FormatConfig;
}
set { _FormatConfig = value; }
}
// when IgnoreUCF is true, get the original data, i.e. don't apply any UCF changes to it
private static bool _IgnoreUCF = false;
public static bool IgnoreUCF
{
get { return PlantFormat._IgnoreUCF; }
set { PlantFormat._IgnoreUCF = value; }
}
// flags that the User Control of Format setting for using additional UCF checkoffs is active
private static bool _DoingUCFCheckOffs = false;
public static bool DoingUCFCheckOffs
{
get { return PlantFormat._DoingUCFCheckOffs; }
set { PlantFormat._DoingUCFCheckOffs = value; }
}
// flags the value that should be used (true/false) for using additional UCF checkoffs (used with DoingUCFCheckOffs)
private static bool _DoingUCFCheckOffsUse = false;
public static bool DoingUCFCheckOffsUse
{
get { return PlantFormat._DoingUCFCheckOffsUse; }
set { PlantFormat._DoingUCFCheckOffsUse = value; }
}
public static FormatConfig GetFormatConfig(IFormatOrFormatInfo format)
{
FormatConfig fc = null;
string str = null;
if (format is Format) str = (format as Format).Config;
else if (format is FormatInfo) str = (format as FormatInfo).Config;
if (str != null && str != "") fc = FormatConfig.Get(str);
return fc;
}
private IFormatOrFormatInfo _MyFormat;
public IFormatOrFormatInfo MyFormat
@ -58,12 +105,76 @@ namespace VEPROMS.CSLA.Library
return _DocStyles;
}
}
public bool HasPageListToken(string token)
{;
string xpath = string.Format("/PlantFormat/PageStyles/PageStyle/Item[@Token = '{0}']", token);
XmlNodeList nl = XmlDoc.SelectNodes(xpath);
return nl.Count > 0;
}
public bool HasPageListToken(string token)
{
string xpath = string.Format("/PlantFormat/PageStyles/PageStyle/Item[@Token = '{0}']", token);
XmlNodeList nl = XmlDoc.SelectNodes(xpath);
return nl.Count > 0;
}
private FormatConfig.ReplaceStrData _UCFandOrigReplaceStrData = null;
public FormatConfig.ReplaceStrData UCFandOrigReplaceStrData
{
get
{
if (_UCFandOrigReplaceStrData != null) return _UCFandOrigReplaceStrData;
_UCFandOrigReplaceStrData = GetMergedReplaceList(this);
return _UCFandOrigReplaceStrData;
}
}
private FormatConfig.ReplaceStrData GetMergedReplaceList(PlantFormat OriginalPlantFormat)
{
// need to compare the original format list with the list as it is stored for working with property grid.
FormatConfig.ReplaceStrData retlist = new FormatConfig.ReplaceStrData(); // merged list
List<string> inoriglist = new List<string>(); // use this list to find new items in formatconfig (see below)
foreach (ReplaceStr origrepstr in OriginalPlantFormat.FormatData.SectData.ReplaceStrList)
{
// In the format config list (UCF), find the 'ReplaceWord'. This is the 'key' for defining whether the
// replace word has been overwridden by UCF data. If it exists, use it:
FormatConfig.ReplaceStr usethisone = null;
bool deleted = false;
// States for replacewords: 0 = no change, -1 deleted, 1 added, 2 modified
if (FormatConfig != null)
{
foreach (FormatConfig.ReplaceStr ucfrepstr in FormatConfig.PlantFormat.FormatData.ReplaceStrData)
{
if (ucfrepstr.ReplaceWord == origrepstr.ReplaceWord)
{
if (ucfrepstr.State == -1) deleted = true;
else usethisone = ucfrepstr;
ucfrepstr.State = 2;
inoriglist.Add(origrepstr.ReplaceWord);
break;
}
}
}
if (!deleted && usethisone == null)
{
usethisone = new FormatConfig.ReplaceStr();
usethisone.Flag = (FormatConfig.E_ReplaceFlagsUCF)origrepstr.Flag;
usethisone.State = 0; // no change
usethisone.ReplaceWith = origrepstr.ReplaceWith;
usethisone.ReplaceWord = origrepstr.ReplaceWord;
}
if (!deleted) retlist.Add(usethisone);
}
// now add in any ucf only replacements, any that are not in the inoriglist
if (FormatConfig != null)
{
foreach (FormatConfig.ReplaceStr ucfrepstr in FormatConfig.PlantFormat.FormatData.ReplaceStrData)
{
if (!inoriglist.Contains(ucfrepstr.ReplaceWord))
{
FormatConfig.ReplaceStr newone = new FormatConfig.ReplaceStr();
newone.Flag = (FormatConfig.E_ReplaceFlagsUCF)ucfrepstr.Flag;
newone.State = 1;
newone.ReplaceWith = ucfrepstr.ReplaceWith;
newone.ReplaceWord = ucfrepstr.ReplaceWord;
retlist.Add(newone);
}
}
}
return (retlist);
}
}
#endregion
#region VE_Font
@ -71,12 +182,20 @@ namespace VEPROMS.CSLA.Library
public class VE_Font : vlnFormatItem
{
public VE_Font(XmlNode xmlNode) : base(xmlNode) { }
private string _ffam = null;
private int _fsize = 0;
private E_Style _fstyle = E_Style.None;
private float _fcpi = 0;
public VE_Font(string family, int size, E_Style style, float CPI)
{
_Family = new LazyLoad<string>(family);
_Size = new LazyLoad<int?>(size);
_Style = new LazyLoad<E_Style?>(style);
_CPI = new LazyLoad<float?>(CPI);
_ffam = family;
_fsize = size;
_fstyle = style;
_fcpi = CPI;
}
private LazyLoad<string> _Family;
private static Dictionary<string, Font> _WinFontLookup = new Dictionary<string, Font>();
@ -127,10 +246,15 @@ namespace VEPROMS.CSLA.Library
style |= FontStyle.Underline;
}
// for now - check size to be 0 and set to 10 if so, error in fmtxml?
if (Family == null) // Need to get inherited font
_WindowsFont = GetFont("Arial", 10, FontStyle.Regular);
else
_WindowsFont = GetFont(Family, Size == 0 ? 10 : (float)Size, style);
if (Family == null) // Need to get inherited font
_WindowsFont = GetFont("Arial", 10, FontStyle.Regular);
else
{
//if (_ffam != null)
// _WindowsFont = GetFont(_ffam, (float)_fsize, style); // this needs work.
//else
_WindowsFont = GetFont(Family, Size == 0 ? 10 : (float)Size, style);
}
}
return _WindowsFont;
}
@ -1107,13 +1231,13 @@ namespace VEPROMS.CSLA.Library
[TypeConverter(typeof(ExpandableObjectConverter))]
public class ProcData : vlnFormatItem
{
public ProcData(XmlNode xmlNode): base(xmlNode) {}
public ProcData(XmlNode xmlNode) : base(xmlNode) { }
private ProcedureSuffixList _ProcedureSuffixList;
public ProcedureSuffixList ProcedureSuffixList
{
get
{
return _ProcedureSuffixList == null? _ProcedureSuffixList = new ProcedureSuffixList(SelectNodes("ProcedureSuffix/string")): _ProcedureSuffixList;
return _ProcedureSuffixList == null ? _ProcedureSuffixList = new ProcedureSuffixList(SelectNodes("ProcedureSuffix/string")) : _ProcedureSuffixList;
}
set { _ProcedureSuffixList = value; }
}
@ -1122,7 +1246,7 @@ namespace VEPROMS.CSLA.Library
{
get
{
return _ChangeBarData == null? _ChangeBarData = new ChangeBarData(SelectSingleNode("ChangeBarData")):_ChangeBarData;
return _ChangeBarData == null ? _ChangeBarData = new ChangeBarData(SelectSingleNode("ChangeBarData")) : _ChangeBarData;
}
}
private CheckOffData _CheckOffData;
@ -1130,7 +1254,7 @@ namespace VEPROMS.CSLA.Library
{
get
{
return _CheckOffData == null? _CheckOffData = new CheckOffData(SelectSingleNode("CheckOffData")):_CheckOffData;
return _CheckOffData == null ? _CheckOffData = new CheckOffData(SelectSingleNode("CheckOffData")) : _CheckOffData;
}
}
private PSI _PSI;
@ -1141,29 +1265,47 @@ namespace VEPROMS.CSLA.Library
return _PSI == null ? _PSI = new PSI(SelectSingleNode("PSI")) : _PSI;
}
}
private LazyLoad<bool> _CheckOffUCF;
public bool CheckOffUCF
{
get
{
// The following line is used in UCF: this needs to be able to control a change in setting in UCF versus its use:
// This is a special case since the original format, using the value in BaseAll, is always 'false'. And the value
// should never be set in original volian plant format files, if the additional UCF checkoffs are to be used, this must
// be set in the UCF user interface.
if (PlantFormat.DoingUCFCheckOffs) return PlantFormat.DoingUCFCheckOffsUse;
if (PlantFormat.IgnoreUCF) return LazyLoad(ref _CheckOffUCF, "@CheckOffUCF");
bool? localvalue = null; // comes to here if in edit or print - use any UCF data before going to original format.
FormatConfig fc = PlantFormat.GetFormatConfig(MyFormat);
if (fc != null) localvalue = fc.PlantFormat.FormatData.Flags.CheckOffUCF;
return localvalue ?? LazyLoad(ref _CheckOffUCF, "@CheckOffUCF");
}
}
private LazyLoad<int?> _TitleLength;
public int? TitleLength
{
get
{
get
{
return LazyLoad(ref _TitleLength, "@TitleLength");
}
}
}
private LazyLoad<int?> _CoverTitleLength;
public int? CoverTitleLength
{
get
{
get
{
return LazyLoad(ref _CoverTitleLength, "@CoverTitleLength");
}
}
}
private LazyLoad<string> _ProcedureSuffixFlags;
public string ProcedureSuffixFlags
{
get
{
get
{
return LazyLoad(ref _ProcedureSuffixFlags, "@ProcedureSuffixFlags");
}
return LazyLoad(ref _ProcedureSuffixFlags, "@ProcedureSuffixFlags");
}
}
private LazyLoad<bool> _CapitalizeTitle;
public bool CapitalizeTitle
@ -1503,22 +1645,146 @@ namespace VEPROMS.CSLA.Library
public class CheckOffData : vlnFormatItem
{
public CheckOffData(XmlNode xmlNode) : base(xmlNode) { }
private CheckOffList _CheckOffList;
private CheckOffList _CheckOffList = null;
public CheckOffList CheckOffList
{
get
{
return _CheckOffList == null? _CheckOffList = new CheckOffList(SelectNodes("CheckOffList/CheckOff"),MyFormat):_CheckOffList;
if (_CheckOffList != null) return _CheckOffList;
// Get a list of checkoffs that should be included:
// if !UseCheckOffUCF (Baseall has it as false. User can change setting in UCF to true)
// if !IgnoreUCF, i.e. use UCF changes, return original lists with only active items (Inactive = false)
// if IgnoreUCF, return original lists with all items
// if UseCheckOffUCF is true use the merged lists from current format and baseall.xml and
// do the same processing for IgnoreUCF described above.
// UseCheckOffUCF is false or there is no FormatConfig (UCF) data:
FormatConfig fc = PlantFormat.GetFormatConfig(MyFormat);
if (!MyFormat.PlantFormat.FormatData.ProcData.CheckOffUCF || fc==null)
{
_CheckOffList = new CheckOffList(SelectNodes("CheckOffList/CheckOff"), MyFormat);
// If Ignoring the UCF data, just return the entire list. Also, return entire list if there is no UCF data (fc == null)
if (!PlantFormat.IgnoreUCF || fc == null) return _CheckOffList;
// If not ignoring UCF settings, only return those that are active
foreach (FormatConfig.CheckOff co in fc.PlantFormat.FormatData.CheckOffList)
{
foreach (CheckOff coo in _CheckOffList)
{
if ((int)coo.Index == Convert.ToInt32(co.Index) && !(bool)co.Active)
{
_CheckOffList.Remove(coo);
break;
}
}
}
return _CheckOffList;
}
// UseCheckOfffUCF is true:
// merge the checkoff list from the current format and the checkoff list from the base format
_CheckOffList = new CheckOffList(SelectNodes("CheckOffList/CheckOff"), MyFormat);
CheckOffList retlist2 = new CheckOffList(SelectNodes("../CheckOffDataUCF/CheckOffList/CheckOff"), MyFormat);
if (retlist2 != null && retlist2.Count > 0) foreach (CheckOff co in retlist2) _CheckOffList.Add(co);
if (PlantFormat.IgnoreUCF) return _CheckOffList;
// if applying UCF, then remove those that are inactive:
foreach (FormatConfig.CheckOff co in fc.PlantFormat.FormatData.CheckOffList)
{
foreach (CheckOff coo in _CheckOffList)
{
if ((int)coo.Index == Convert.ToInt32(co.Index) && !(bool)co.Active)
{
_CheckOffList.Remove(coo);
break;
}
}
}
return _CheckOffList;
}
}
public void ClearCheckOffAndHeaderLists()
{
_CheckOffList = null;
_CheckOffHeaderList = null;
}
private CheckOffHeaderList _CheckOffHeaderList;
public CheckOffHeaderList CheckOffHeaderList
{
get
{
return _CheckOffHeaderList == null? _CheckOffHeaderList = new CheckOffHeaderList(SelectNodes("CheckOffHeaderList/CheckOffHeader"),MyFormat): _CheckOffHeaderList;
if (_CheckOffHeaderList != null) return _CheckOffHeaderList;
FormatConfig fc = PlantFormat.GetFormatConfig(MyFormat);
if (!MyFormat.PlantFormat.FormatData.ProcData.CheckOffUCF || fc == null)
{
_CheckOffHeaderList = new CheckOffHeaderList(SelectNodes("CheckOffHeaderList/CheckOffHeader"), MyFormat);
// Depending on the IgnoreUCF flag, either return this list with UCF Inactive flags set or return the
// list as is.
if (PlantFormat.IgnoreUCF || fc == null) return _CheckOffHeaderList;
// If not ignoring UCF settings, only return those that are active
foreach (FormatConfig.CheckOffHeader coh in fc.PlantFormat.FormatData.CheckOffHeaderList)
{
foreach (CheckOffHeader coo in _CheckOffHeaderList)
{
if ((int)coo.Index == Convert.ToInt32(coh.Index) && !(bool)coh.Active)
{
_CheckOffHeaderList.Remove(coo);
break;
}
}
}
return _CheckOffHeaderList;
}
// merge the checkoff header lists from the current format and the list from the base
_CheckOffHeaderList = new CheckOffHeaderList(SelectNodes("CheckOffHeaderList/CheckOffHeader"), MyFormat);
CheckOffHeaderList retlist2 = new CheckOffHeaderList(SelectNodes("../CheckOffDataUCF/CheckOffHeaderList/CheckOffHeader"), MyFormat);
if (retlist2 != null && retlist2.Count > 0) foreach (CheckOffHeader co in retlist2) _CheckOffHeaderList.Add(co);
if (PlantFormat.IgnoreUCF) return _CheckOffHeaderList;
// if applying UCF, then remove those that are inactive.
foreach (FormatConfig.CheckOffHeader coh in fc.PlantFormat.FormatData.CheckOffHeaderList)
{
foreach (CheckOffHeader cooh in _CheckOffHeaderList)
{
if ((int)cooh.Index == Convert.ToInt32(coh.Index) && !(bool)coh.Active)
{
_CheckOffHeaderList.Remove(cooh);
break;
}
}
}
return _CheckOffHeaderList;
}
}
public void CheckOffHeaderListRefresh(bool CheckOffUCF)
{
if (!CheckOffUCF)
{
_CheckOffHeaderList = new CheckOffHeaderList(SelectNodes("CheckOffHeaderList/CheckOffHeader"), MyFormat);
// Depending on the IgnoreUCF flag, either return this list with UCF Inactive flags set or return the
// list as is.
FormatConfig fc = PlantFormat.GetFormatConfig(MyFormat);
if (PlantFormat.IgnoreUCF || fc == null) return;
// If not ignoring UCF settings, only return those that are active
foreach (FormatConfig.CheckOffHeader coh in fc.PlantFormat.FormatData.CheckOffHeaderList)
{
foreach (CheckOffHeader coo in _CheckOffHeaderList)
{
if ((int)coo.Index == Convert.ToInt32(coh.Index) && !(bool)coh.Active)
{
_CheckOffHeaderList.Remove(coo);
break;
}
}
}
return;
}
// if coming from the UCF dialog, then check for the 'ignoreUCF' this will flag whether to only
// merge the checkoff header lists from the current format and the list from the base
CheckOffHeaderList retlist = new CheckOffHeaderList(SelectNodes("CheckOffHeaderList/CheckOffHeader"), MyFormat);
CheckOffHeaderList retlist2 = new CheckOffHeaderList(SelectNodes("../CheckOffDataUCF/CheckOffHeaderList/CheckOffHeader"), MyFormat);
if (retlist2 != null && retlist2.Count > 0) foreach (CheckOffHeader co in retlist2) retlist.Add(co);
_CheckOffHeaderList = retlist;
}
private LazyLoad<bool> _CheckOffHeaderInPagelist;
public bool CheckOffHeaderInPagelist
{
@ -1619,57 +1885,6 @@ namespace VEPROMS.CSLA.Library
}
}
#endregion
//#region RightCheckOffBox
//[TypeConverter(typeof(ExpandableObjectConverter))]
//public class RightCheckOffBox : vlnFormatItem, IVlnIndexedFormatItem
//{
// public RightCheckOffBox(XmlNode xmlNode) : base(xmlNode) { }
// public RightCheckOffBox() : base() { }
// private LazyLoad<int?> _Index;
// public int? Index
// {
// get
// {
// return LazyLoad(ref _Index, "@Index");
// }
// }
// private LazyLoad<int?> _RightCheckOffBoxChar;
// public int? RightCheckOffBoxChar
// {
// get
// {
// return LazyLoad(ref _RightCheckOffBoxChar, "@RightCheckOffBoxChar");
// }
// }
// public override string GetPDDisplayName()
// { return string.Format("[{0}]", Index); }
// public override string GetPDDescription()
// { return string.Format("[{0}] - {1}", Index, RightCheckOffBoxChar); }
// public override string GetPDCategory()
// { return "RightCheckOffBox Data"; }
// public override string ToString()
// {
// return RightCheckOffBoxChar.ToString();
// }
//}
//#endregion
//#region RightCheckOffBoxList
//[TypeConverter(typeof(vlnIndexedListConverter<RightCheckOffBoxList, RightCheckOffBox>))]
//public class RightCheckOffBoxList : vlnIndexedFormatList<RightCheckOffBox>
//{
// public RightCheckOffBoxList(XmlNodeList xmlNodeList,IFormatOrFormatInfo myFormat) : base(xmlNodeList,myFormat) { }
// public override vlnIndexedFormatList<RightCheckOffBox> InheritedList
// {
// get
// {
// IFormatOrFormatInfo parentFormat = MyFormat.MyIParent;
// if (parentFormat != null)
// return parentFormat.PlantFormat.FormatData.ProcData.CheckOffData.RightCheckOffBoxList;
// return null;
// }
// }
//}
//#endregion
#region CheckOff
[TypeConverter(typeof(ExpandableObjectConverter))]
public class CheckOff : vlnFormatItem,IVlnIndexedFormatItem
@ -3531,7 +3746,11 @@ namespace VEPROMS.CSLA.Library
{
get
{
return LazyLoad(ref _CompressSteps, "@CompressSteps");
if (PlantFormat.IgnoreUCF) return LazyLoad(ref _CompressSteps, "@CompressSteps");
bool? localvalue = null;
FormatConfig fc = PlantFormat.GetFormatConfig(MyFormat);
if (fc != null) localvalue = fc.PlantFormat.FormatData.Flags.CompressSteps;
return localvalue ?? LazyLoad(ref _CompressSteps, "@CompressSteps");
}
}
private LazyLoad<bool> _DoSTExtraAtTop;
@ -3718,7 +3937,11 @@ namespace VEPROMS.CSLA.Library
{
get
{
return LazyLoad(ref _PartialStepCompression, "@PartialStepCompression");
if (PlantFormat.IgnoreUCF) return LazyLoad(ref _PartialStepCompression, "@PartialStepCompression");
bool? localvalue = null;
FormatConfig fc = PlantFormat.GetFormatConfig(MyFormat);
if (fc != null) localvalue = fc.PlantFormat.FormatData.Flags.PartialStepCompression;
return localvalue ?? LazyLoad(ref _PartialStepCompression, "@PartialStepCompression");
}
}
private LazyLoad<bool> _VirtualDotInHLSTab;
@ -5072,11 +5295,41 @@ namespace VEPROMS.CSLA.Library
return LazyLoad(ref _Quoted, "@Quoted");
}
}
private VE_Font GetUCFFontAsVE_Font()
{
// if formatconfig & step list, then go through to see if index exists, if so and if there is a font, use it:
if (MyFormat.PlantFormat.FormatConfig != null && MyFormat.PlantFormat.FormatConfig.PlantFormat != null && MyFormat.PlantFormat.FormatConfig.PlantFormat.FormatData != null && MyFormat.PlantFormat.FormatConfig.PlantFormat.FormatData.StepData != null)
{
foreach (FormatConfig.Step stp in MyFormat.PlantFormat.FormatConfig.PlantFormat.FormatData.StepData)
{
if (Convert.ToInt32(stp.Index) == (int)Index && stp.FontDesc != null && stp.FontDesc.Font != null && stp.FontDesc.Font != "")
{
System.Drawing.FontConverter cvt = new System.Drawing.FontConverter();
System.Drawing.Font windowsFont = cvt.ConvertFromString(stp.FontDesc.Font) as System.Drawing.Font;
E_Style myStyle = E_Style.None;
if (windowsFont.Bold) myStyle |= E_Style.Bold;
if (windowsFont.Underline) myStyle |= E_Style.Underline;
if (windowsFont.Italic) myStyle |= E_Style.Italics;
return (new VE_Font(windowsFont.Name, (int)windowsFont.Size, myStyle, windowsFont.SizeInPoints));
}
}
}
return null;
}
private VE_Font _Font;
public VE_Font Font
{
get
{
if (PlantFormat.IgnoreUCF) return (_Font == null) ?_Font = new VE_Font(base.XmlNode): _Font;
if (_Font != null) return (_Font);
VE_Font vef = GetUCFFontAsVE_Font();
if (vef != null)
{
_Font = vef;
return vef;
}
return (_Font == null) ?_Font = new VE_Font(base.XmlNode): _Font;
}
}

View File

@ -642,6 +642,19 @@ namespace VEPROMS.CSLA.Library
return max;
}
}
public int MaxIndexNoInherit
{
get
{
int max = base.Count;
foreach (T tmp in this)
{
if (tmp.Index >= max)
max = ((int)tmp.Index) + 1;
}
return max;
}
}
#region ICustomTypeDescriptor
public String GetClassName()
{ return TypeDescriptor.GetClassName(this, true); }

View File

@ -262,6 +262,27 @@ namespace VEPROMS.CSLA.Library
}
}
}
private string _Config = string.Empty;
public string Config
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty("Config", true);
return _Config;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty("Config", true);
if (value == null) value = string.Empty;
if (_Config != value)
{
_Config = value;
PropertyHasChanged();
}
}
}
private string _GenMac = string.Empty;
public string GenMac
{
@ -559,15 +580,18 @@ namespace VEPROMS.CSLA.Library
Csla.Validation.CommonRules.StringRequired, "Name");
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 20));
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 100));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Description", 250));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringRequired, "Data");
//ValidationRules.AddRule(
// Csla.Validation.CommonRules.StringRequired, "Data");
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Data", 1073741823));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Config", 1073741823));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("GenMac", 1073741823));
@ -747,13 +771,14 @@ namespace VEPROMS.CSLA.Library
tmp.Data = data;
return tmp;
}
public static Format New(Format myParent, string name, string description, string data, string genMac, DateTime dts, string userID)
public static Format New(Format myParent, string name, string description, string data, string config, string genMac, DateTime dts, string userID)
{
Format tmp = Format.New();
tmp.MyParent = myParent;
tmp.Name = name;
tmp.Description = description;
tmp.Data = data;
tmp.Config = config;
tmp.GenMac = genMac;
tmp.DTS = dts;
tmp.UserID = userID;
@ -761,7 +786,7 @@ namespace VEPROMS.CSLA.Library
}
public static Format MakeFormat(Format myParent, string name, string description, string data, string genMac, DateTime dts, string userID)
{
Format tmp = Format.New(myParent, name, description, data, genMac, dts, userID);
Format tmp = Format.New(myParent, name, description, data, null, genMac, dts, userID);
if (tmp.IsSavable)
tmp = tmp.Save();
else
@ -775,19 +800,20 @@ namespace VEPROMS.CSLA.Library
}
return tmp;
}
public static Format New(Format myParent, string name, string description, string data, string genMac)
public static Format New(Format myParent, string name, string description, string data, string config, string genMac)
{
Format tmp = Format.New();
tmp.MyParent = myParent;
tmp.Name = name;
tmp.Description = description;
tmp.Data = data;
tmp.Config = config;
tmp.GenMac = genMac;
return tmp;
}
public static Format MakeFormat(Format myParent, string name, string description, string data, string genMac)
{
Format tmp = Format.New(myParent, name, description, data, genMac);
Format tmp = Format.New(myParent, name, description, data, null, genMac);
if (tmp.IsSavable)
tmp = tmp.Save();
else
@ -953,6 +979,7 @@ namespace VEPROMS.CSLA.Library
_Name = dr.GetString("Name");
_Description = dr.GetString("Description");
_Data = dr.GetString("Data");
_Config = dr.GetString("Config");
_GenMac = dr.GetString("GenMac");
_DTS = dr.GetDateTime("DTS");
_UserID = dr.GetString("UserID");
@ -1094,6 +1121,7 @@ namespace VEPROMS.CSLA.Library
cm.Parameters.AddWithValue("@Name", _Name);
cm.Parameters.AddWithValue("@Description", _Description);
cm.Parameters.AddWithValue("@Data", _Data);
cm.Parameters.AddWithValue("@Config", _Config);
cm.Parameters.AddWithValue("@GenMac", _GenMac);
if (_DTS.Year >= 1753 && _DTS.Year <= 9999) cm.Parameters.AddWithValue("@DTS", _DTS);
cm.Parameters.AddWithValue("@UserID", _UserID);
@ -1126,7 +1154,7 @@ namespace VEPROMS.CSLA.Library
}
}
[Transactional(TransactionalTypes.TransactionScope)]
public static byte[] Add(SqlConnection cn, ref int formatID, Format myParent, string name, string description, string data, string genMac, DateTime dts, string userID)
public static byte[] Add(SqlConnection cn, ref int formatID, Format myParent, string name, string description, string data, string config, string genMac, DateTime dts, string userID)
{
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Format.Add", 0);
try
@ -1141,6 +1169,7 @@ namespace VEPROMS.CSLA.Library
cm.Parameters.AddWithValue("@Name", name);
cm.Parameters.AddWithValue("@Description", description);
cm.Parameters.AddWithValue("@Data", data);
cm.Parameters.AddWithValue("@Config", config);
cm.Parameters.AddWithValue("@GenMac", genMac);
if (dts.Year >= 1753 && dts.Year <= 9999) cm.Parameters.AddWithValue("@DTS", dts);
cm.Parameters.AddWithValue("@UserID", userID);
@ -1208,6 +1237,7 @@ namespace VEPROMS.CSLA.Library
cm.Parameters.AddWithValue("@Name", _Name);
cm.Parameters.AddWithValue("@Description", _Description);
cm.Parameters.AddWithValue("@Data", _Data);
cm.Parameters.AddWithValue("@Config", _Config);
cm.Parameters.AddWithValue("@GenMac", _GenMac);
if (_DTS.Year >= 1753 && _DTS.Year <= 9999) cm.Parameters.AddWithValue("@DTS", _DTS);
cm.Parameters.AddWithValue("@UserID", _UserID);
@ -1243,9 +1273,9 @@ namespace VEPROMS.CSLA.Library
{
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
if (IsNew)
_LastChanged = Format.Add(cn, ref _FormatID, _MyParent, _Name, _Description, _Data, _GenMac, _DTS, _UserID);
_LastChanged = Format.Add(cn, ref _FormatID, _MyParent, _Name, _Description, _Data, _Config, _GenMac, _DTS, _UserID);
else
_LastChanged = Format.Update(cn, ref _FormatID, _ParentID, _Name, _Description, _Data, _GenMac, _DTS, _UserID, ref _LastChanged);
_LastChanged = Format.Update(cn, ref _FormatID, _ParentID, _Name, _Description, _Data, _Config, _GenMac, _DTS, _UserID, ref _LastChanged);
MarkOld();
}
if (_FormatFolders != null) _FormatFolders.Update(this);
@ -1264,7 +1294,7 @@ namespace VEPROMS.CSLA.Library
MarkNew();
}
[Transactional(TransactionalTypes.TransactionScope)]
public static byte[] Update(SqlConnection cn, ref int formatID, int parentID, string name, string description, string data, string genMac, DateTime dts, string userID, ref byte[] lastChanged)
public static byte[] Update(SqlConnection cn, ref int formatID, int parentID, string name, string description, string data, string config, string genMac, DateTime dts, string userID, ref byte[] lastChanged)
{
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Format.Update", 0);
try
@ -1280,6 +1310,7 @@ namespace VEPROMS.CSLA.Library
cm.Parameters.AddWithValue("@Name", name);
cm.Parameters.AddWithValue("@Description", description);
cm.Parameters.AddWithValue("@Data", data);
cm.Parameters.AddWithValue("@Config", config);
cm.Parameters.AddWithValue("@GenMac", genMac);
if (dts.Year >= 1753 && dts.Year <= 9999) cm.Parameters.AddWithValue("@DTS", dts);
cm.Parameters.AddWithValue("@UserID", userID);

View File

@ -152,6 +152,16 @@ namespace VEPROMS.CSLA.Library
return _Data;
}
}
private string _Config = string.Empty;
public string Config
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty("Config", true);
return _Config;
}
}
private string _GenMac = string.Empty;
public string GenMac
{
@ -417,6 +427,7 @@ namespace VEPROMS.CSLA.Library
_Name = tmp.Name;
_Description = tmp.Description;
_Data = tmp.Data;
_Config = tmp.Config;
_GenMac = tmp.GenMac;
_DTS = tmp.DTS;
_UserID = tmp.UserID;
@ -483,6 +494,7 @@ namespace VEPROMS.CSLA.Library
_Name = dr.GetString("Name");
_Description = dr.GetString("Description");
_Data = dr.GetString("Data");
_Config = dr.GetString("Config");
_GenMac = dr.GetString("GenMac");
_DTS = dr.GetDateTime("DTS");
_UserID = dr.GetString("UserID");

View File

@ -103,6 +103,7 @@ namespace VEPROMS.CSLA.Library
public static void Reset()
{
_FormatInfoList = null;
_SortedFormatInfoList = null;
}
// CSLATODO: Add alternative gets -
//public static FormatInfoList Get(<criteria>)

View File

@ -0,0 +1,277 @@
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using System.Drawing.Design;
using System.Windows.Forms.Design;
namespace Volian.Base.Library
{
public class FlagCheckedListBox : CheckedListBox
{
private System.ComponentModel.Container components = null;
public FlagCheckedListBox()
{
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (components != null)
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
private void InitializeComponent()
{
//
// FlaggedCheckedListBox
//
this.CheckOnClick = true;
}
#endregion
// Adds an integer value and its associated description
public FlagCheckedListBoxItem Add(uint v, string c)
{
FlagCheckedListBoxItem item = new FlagCheckedListBoxItem(v, c);
Items.Add(item);
return item;
}
public FlagCheckedListBoxItem Add(FlagCheckedListBoxItem item)
{
Items.Add(item);
return item;
}
protected override void OnItemCheck(ItemCheckEventArgs e)
{
base.OnItemCheck(e);
if (isUpdatingCheckStates)
return;
// Get the checked/unchecked item
FlagCheckedListBoxItem item = Items[e.Index] as FlagCheckedListBoxItem;
// Update other items
UpdateCheckedItems(item, e.NewValue);
}
// Checks/Unchecks items depending on the give bitvalue
protected void UpdateCheckedItems(uint value)
{
isUpdatingCheckStates = true;
// Iterate over all items
for (int i = 0; i < Items.Count; i++)
{
FlagCheckedListBoxItem item = Items[i] as FlagCheckedListBoxItem;
if (item.value == 0)
{
SetItemChecked(i, value == 0);
}
else
{
// If the bit for the current item is on in the bitvalue, check it
if ((item.value & value) == item.value && item.value != 0)
SetItemChecked(i, true);
// Otherwise uncheck it
else
SetItemChecked(i, false);
}
}
isUpdatingCheckStates = false;
}
// Updates items in the checklistbox
// composite = The item that was checked/unchecked
// cs = The check state of that item
protected void UpdateCheckedItems(FlagCheckedListBoxItem composite, CheckState cs)
{
// If the value of the item is 0, call directly.
if (composite.value == 0)
UpdateCheckedItems(0);
// Get the total value of all checked items
uint sum = 0;
for (int i = 0; i < Items.Count; i++)
{
FlagCheckedListBoxItem item = Items[i] as FlagCheckedListBoxItem;
// If item is checked, add its value to the sum.
if (GetItemChecked(i))
sum |= item.value;
}
// If the item has been unchecked, remove its bits from the sum
if (cs == CheckState.Unchecked)
sum = sum & (~composite.value);
// If the item has been checked, combine its bits with the sum
else
sum |= composite.value;
// Update all items in the checklistbox based on the final bit value
UpdateCheckedItems(sum);
}
private bool isUpdatingCheckStates = false;
// Gets the current bit value corresponding to all checked items
public uint GetCurrentValue()
{
uint sum = 0;
for (int i = 0; i < Items.Count; i++)
{
FlagCheckedListBoxItem item = Items[i] as FlagCheckedListBoxItem;
if (GetItemChecked(i))
sum |= item.value;
}
return sum;
}
Type enumType;
Enum enumValue;
// Adds items to the checklistbox based on the members of the enum
private void FillEnumMembers()
{
foreach (string name in Enum.GetNames(enumType))
{
object val = Enum.Parse(enumType, name);
uint intVal = (uint)Convert.ChangeType(val, typeof(uint));
Add(intVal, name);
}
}
// Checks/unchecks items based on the current value of the enum variable
private void ApplyEnumValue()
{
uint intVal = (uint)Convert.ChangeType(enumValue, typeof(uint));
UpdateCheckedItems(intVal);
}
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]
public Enum EnumValue
{
get
{
object e = Enum.ToObject(enumType, GetCurrentValue());
return (Enum)e;
}
set
{
Items.Clear();
enumValue = value; // Store the current enum value
enumType = value.GetType(); // Store enum type
FillEnumMembers(); // Add items for enum members
ApplyEnumValue(); // Check/uncheck items depending on enum value
}
}
}
// Represents an item in the checklistbox
public class FlagCheckedListBoxItem
{
public FlagCheckedListBoxItem(uint v, string c)
{
value = v;
caption = c;
}
public override string ToString()
{
return caption;
}
// Returns true if the value corresponds to a single bit being set
public bool IsFlag
{
get
{
return ((value & (value - 1)) == 0);
}
}
// Returns true if this value is a member of the composite bit value
public bool IsMemberFlag(FlagCheckedListBoxItem composite)
{
return (IsFlag && ((value & composite.value) == value));
}
public uint value;
public string caption;
}
// UITypeEditor for flag enums
public class FlagEnumUIEditor : UITypeEditor
{
// The checklistbox
private FlagCheckedListBox flagEnumCB;
public FlagEnumUIEditor()
{
flagEnumCB = new FlagCheckedListBox();
flagEnumCB.BorderStyle = BorderStyle.None;
}
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
if (context != null
&& context.Instance != null
&& provider != null)
{
IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
if (edSvc != null)
{
Enum e = (Enum)Convert.ChangeType(value, context.PropertyDescriptor.PropertyType);
flagEnumCB.EnumValue = e;
edSvc.DropDownControl(flagEnumCB);
return flagEnumCB.EnumValue;
}
}
return null;
}
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
{
return UITypeEditorEditStyle.DropDown;
}
}
}

View File

@ -0,0 +1,300 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Windows.Forms;
using System.Reflection;
namespace Volian.Base.Library
{
// The PropGridCollEditor expands the functionality of the CollectionEditor (the collection editor comes up when in a
// property grid, and the current selected item is a collection, and the user selects the '...'.
public class PropGridCollEditor : CollectionEditor
{
// Define a static event to expose the inner PropertyGrid's
// PropertyValueChanged event args...
public delegate void MyPropertyValueChangedEventHandler(object sender, PropertyValueChangedEventArgs e);
public static event MyPropertyValueChangedEventHandler MyPropertyValueChanged;
private bool AllowAddDel = false; // flags whether the Add/Delete buttons should be displayed:
// Inherit the default constructor from the standard
// Collection Editor...
private Type _origType;
public PropGridCollEditor(Type type)
: base(type)
{
AllowAddDel = false;
_origType = type;
if (type.Name == "ReplaceStrData") AllowAddDel = true; // Defaults to not having the 'Add' & 'Remove' buttons.
}
protected override Type CreateCollectionItemType()
{
return base.CreateCollectionItemType();
}
private Button resetbtn = null;
// Override this method in order to access the containing user controls
// from the default Collection Editor form or to add new ones...
protected override CollectionForm CreateCollectionForm()
{
// Getting the default layout of the Collection Editor...
CollectionForm collectionForm = base.CreateCollectionForm();
Form frmCollectionEditorForm = collectionForm as Form;
// The Add/Remove buttons are made invisible:
if (!AllowAddDel) HideAddRemoveButtons(0, frmCollectionEditorForm);
Button okbtn = FindOkButton(frmCollectionEditorForm);
if (!AllowAddDel)
{
// add a reset button and put next to ok button:
resetbtn = new Button();
resetbtn.Text = "Reset";
resetbtn.Location = new System.Drawing.Point(okbtn.Location.X - 20, okbtn.Location.Y);
resetbtn.Width = 250;
resetbtn.Visible = true;
resetbtn.Enabled = false; // only enabled on data change
resetbtn.Click += resetbtn_Click;
okbtn.Parent.Controls.Add(resetbtn);
}
SetMembersLabel(collectionForm);
TableLayoutPanel tlpLayout = frmCollectionEditorForm.Controls[0] as TableLayoutPanel;
if (tlpLayout != null)
{
// Get a reference to the inner PropertyGrid and hook an event handler to it.
if (tlpLayout.Controls[5] is PropertyGrid)
{
propertyGrid = tlpLayout.Controls[5] as PropertyGrid;
propertyGrid.PropertyValueChanged += new PropertyValueChangedEventHandler(propertyGrid_PropertyValueChanged);
propertyGrid.SelectedGridItemChanged += PG_SelectedGridItemChanged;
}
}
return collectionForm;
}
// when the reset button is clicked the data will be reset to the data from the original format file. Note that if
// data is added to the UCF that is part of a collection, code will need to be added here to reset the value.
void resetbtn_Click(object sender, EventArgs e)
{
resetbtn.Text = "Reset";
resetbtn.Enabled = false;
if (SelectedGridField.Contains("Left Margin"))
ResetValue(propertyGrid.SelectedGridItem.Parent.Value, "LeftMargin");
else if (SelectedGridField.Contains("Page Length"))
ResetValue(propertyGrid.SelectedGridItem.Parent.Value, "PageLength");
else if (SelectedGridField.Contains("WindowsFont"))
ResetValue(propertyGrid.SelectedGridItem.Parent.Value, "WindowsFont");
else if (SelectedGridField.Contains("Inactive CheckOff Header"))
ResetValue(propertyGrid.SelectedGridItem.Parent.Value, "Inactive");
else if (SelectedGridField.Contains("Inactive CheckOff"))
ResetValue(propertyGrid.SelectedGridItem.Parent.Parent.Value, "Inactive");
}
private void ShowReflection(Object data)
{
if (data == null) return;
//Object data = new A();
FieldInfo[] fields = data.GetType().GetFields(BindingFlags.Public |
BindingFlags.NonPublic |
BindingFlags.Instance);
String str = "";
foreach (FieldInfo f in fields)
{
str += f.Name + " = " + f.GetValue(data) + "\r\n";
}
Console.WriteLine("reflection = {0}", str);
}
PropertyGrid propertyGrid = null;
private string SelectedGridField = "";
// The following method is used to enable and set text on the 'Reset' button. When a grid item is selected, if it has
// UCF data, then put the original value as part of the button text & enable it:
void PG_SelectedGridItemChanged(object sender, SelectedGridItemChangedEventArgs e)
{
if (resetbtn == null) return;
if (propertyGrid != null) Console.WriteLine(LabelPath(propertyGrid.SelectedGridItem)); // PG.SelectedGridItem.Label + " : " + PG.SelectedGridItem.Value;
// see if data has changed, and if so, enable the Reset button.
bool enabled = false;
resetbtn.Text = "Reset";
SelectedGridField = LabelPath(propertyGrid.SelectedGridItem);
if (SelectedGridField.Contains("WindowsFont"))
{
string origForButton = OrigValue(propertyGrid.SelectedGridItem.Parent.Value, "WindowsFont");
if (origForButton != null)
{
resetbtn.Text = "Reset to " + origForButton;
enabled = true;
}
}
else if (SelectedGridField.Contains("Left Margin"))
{
string origForButton = OrigValue(propertyGrid.SelectedGridItem.Parent.Value, "LeftMargin");
if (origForButton != null)
{
resetbtn.Text = "Reset to " + origForButton;
enabled = true;
}
}
else if (SelectedGridField.Contains("Page Length"))
{
string origForButton = OrigValue(propertyGrid.SelectedGridItem.Parent.Value, "PageLength");
if (origForButton != null)
{
resetbtn.Text = "Reset to " + origForButton;
enabled = true;
}
}
else if (SelectedGridField.Contains("Active CheckOff Header"))
{
string origForButton = OrigValue(propertyGrid.SelectedGridItem.Parent.Parent.Value, "Active");
if (origForButton != null)
{
resetbtn.Text = "Reset to " + origForButton;
enabled = true;
}
}
else if (SelectedGridField.Contains("Active CheckOff"))
{
string origForButton = OrigValue(propertyGrid.SelectedGridItem.Parent.Parent.Value, "Active");
if (origForButton != null)
{
resetbtn.Text = "Reset to " + origForButton;
enabled = true;
}
}
else enabled = false;
resetbtn.Enabled = enabled;
}
// This code,using data reflection, will determine the if there is UCF (changed) data, and if so
// will return its value as a string for concatenation of Reset button text.
private string OrigValue(object data, string fieldName)
{
FieldInfo fldVal = null;
FieldInfo fldOrig = null;
if (data == null) return null;
FieldInfo[] fields = data.GetType().GetFields(BindingFlags.Public |
BindingFlags.NonPublic |
BindingFlags.Instance);
// Go through the fields in the data structure, looking to match that passed in. Also look for the original
// field to compare the 2 to see if a change was made, i.e. UCF data exists.
foreach (FieldInfo f in fields)
{
if (f.Name == "_" + fieldName) fldVal = f;
if (f.Name == "_Orig" + fieldName) fldOrig = f;
}
if (fldVal != null && fldOrig != null)
{
try
{
// see if values are different:
string orig = fldOrig.GetValue(data).ToString();
string newv = fldVal.GetValue(data).ToString();
string retval = fldOrig.GetValue(data).ToString();
if (retval.StartsWith("[Font:"))
{
retval = retval.Replace("[Font: Name=", "").Replace(", Size=", ",");
}
if (orig != newv) return retval;
else return null;
}
catch (Exception ex)
{
return null;
}
}
return null;
}
// The following Resets the format variable's value from the original format (as stored in the 'OrigXXX' field in FormatConfig
private void ResetValue(object data, string fieldName)
{
FieldInfo fldVal = null;
FieldInfo fldOrig = null;
if (data == null) return;
FieldInfo[] fields = data.GetType().GetFields(BindingFlags.Public |
BindingFlags.NonPublic |
BindingFlags.Instance);
foreach (FieldInfo f in fields)
{
if (f.Name == "_" + fieldName) fldVal = f;
if (f.Name == "_Orig" + fieldName) fldOrig = f;
}
if (fldVal != null && fldOrig != null)
{
fldVal.SetValue(data, fldOrig.GetValue(data));
propertyGrid.Refresh();
}
}
// Remove this on release, and any uses of it.
private string LabelPath(GridItem gi)
{
return (gi.Parent == null ? "" : LabelPath(gi.Parent) + ":" + gi.Label);
}
// set the 'members' label to better reflect what is displayed:
private bool SetMembersLabel(Control myControl)
{
if (myControl is Label && myControl.Text.ToUpper().Contains("MEMBER"))
{
string dt = myControl.TopLevelControl.Text;
if (dt.ToUpper().Contains("DOCSTYL")) myControl.Text = "Section Types";
else if (dt.ToUpper().Contains("REPLACE")) myControl.Text = "Replace Words";
else if (dt.ToUpper().Contains("CHECKOFFHEADER")) myControl.Text = "CheckOff Headers";
else if (dt.ToUpper().Contains("CHECKOFF")) myControl.Text = "CheckOffs";
else if (dt.ToUpper().Contains("STEP")) myControl.Text = "Steps";
return true;
}
if (myControl.Controls != null && myControl.Controls.Count > 0)
{
foreach (Control con in myControl.Controls)
{
bool found = SetMembersLabel(con);
if (found == true) return true;
}
}
return false;
}
// This code looks for the 'OK' button, so that the 'Reset' button can be placed by it.
private Button FindOkButton(Control myControl)
{
if (myControl is Button && myControl.Text == "OK")
{
return myControl as Button;
}
if (myControl.Controls != null && myControl.Controls.Count > 0)
{
foreach (Control con in myControl.Controls)
{
Button found = FindOkButton(con);
if (found != null) return found;
}
}
return null;
}
// Find the 'Add' & 'Remove' buttons based on their text, and then make invisible.
private void HideAddRemoveButtons(int level, Control myControl)
{
if (myControl.Text == "&Add" || myControl.Text == "&Remove")
{
myControl.Visible = false;
return;
}
if (myControl.Controls != null && myControl.Controls.Count > 0)
{
foreach (Control con in myControl.Controls)
HideAddRemoveButtons(level + 1, con);
}
}
void propertyGrid_PropertyValueChanged(object sender, PropertyValueChangedEventArgs e)
{
// Fire our customized collection event...
if (PropGridCollEditor.MyPropertyValueChanged != null)
{
PropGridCollEditor.MyPropertyValueChanged(this, e);
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,36 @@
using System.ComponentModel;
using System.Drawing.Design;
using System.Windows.Forms;
using System.Windows.Forms.Design;
using System;
namespace Volian.Base.Library
{
// The RtfEditor inherits from the UITypeEditor and is used to edit Rtf fields. This provides the interface for fields in FormatConfig
// and uses the frmRtfEdit to provide a mechanism to do basic editing of text with a subset of rtf command support.
public class RtfEditor : UITypeEditor
{
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
{
return UITypeEditorEditStyle.Modal;
}
public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
{
IWindowsFormsEditorService svc = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
string rw = value as string;
if (svc != null && rw != null)
{
using (frmRtfEdit form = new frmRtfEdit())
{
form.Value = rw;
if (svc.ShowDialog(form) == DialogResult.OK)
{
rw = form.Value; // update object
}
}
}
return rw;
}
}
}

View File

@ -0,0 +1,179 @@
namespace Volian.Base.Library
{
partial class frmRtfEdit
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnOK = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.rtfBox = new System.Windows.Forms.RichTextBox();
this.btnBold = new DevComponents.DotNetBar.ButtonX();
this.btnItalics = new DevComponents.DotNetBar.ButtonX();
this.btnUnderline = new DevComponents.DotNetBar.ButtonX();
this.btnSubscript = new DevComponents.DotNetBar.ButtonX();
this.btnSuperscript = new DevComponents.DotNetBar.ButtonX();
this.btnHardspace = new DevComponents.DotNetBar.ButtonX();
this.SuspendLayout();
//
// btnOK
//
this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnOK.Location = new System.Drawing.Point(38, 144);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(75, 23);
this.btnOK.TabIndex = 3;
this.btnOK.Text = "OK";
this.btnOK.UseVisualStyleBackColor = true;
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(143, 144);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 4;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// rtfBox
//
this.rtfBox.Location = new System.Drawing.Point(38, 73);
this.rtfBox.Name = "rtfBox";
this.rtfBox.Size = new System.Drawing.Size(214, 50);
this.rtfBox.TabIndex = 5;
this.rtfBox.Text = "";
this.rtfBox.SelectionChanged += new System.EventHandler(this.rtfBox_SelectionChanged);
//
// btnBold
//
this.btnBold.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnBold.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnBold.Location = new System.Drawing.Point(12, 12);
this.btnBold.Name = "btnBold";
this.btnBold.Size = new System.Drawing.Size(31, 24);
this.btnBold.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnBold.TabIndex = 6;
this.btnBold.Text = "B";
this.btnBold.Click += new System.EventHandler(this.btnBold_Click);
//
// btnItalics
//
this.btnItalics.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnItalics.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnItalics.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnItalics.Location = new System.Drawing.Point(43, 12);
this.btnItalics.Name = "btnItalics";
this.btnItalics.Size = new System.Drawing.Size(31, 24);
this.btnItalics.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnItalics.TabIndex = 7;
this.btnItalics.Text = "I";
this.btnItalics.Click += new System.EventHandler(this.btnItalics_Click);
//
// btnUnderline
//
this.btnUnderline.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnUnderline.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnUnderline.Location = new System.Drawing.Point(74, 12);
this.btnUnderline.Name = "btnUnderline";
this.btnUnderline.Size = new System.Drawing.Size(31, 24);
this.btnUnderline.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnUnderline.TabIndex = 8;
this.btnUnderline.Text = "U";
this.btnUnderline.Click += new System.EventHandler(this.btnUnderline_Click);
//
// btnSubscript
//
this.btnSubscript.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnSubscript.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnSubscript.Location = new System.Drawing.Point(12, 42);
this.btnSubscript.Name = "btnSubscript";
this.btnSubscript.Size = new System.Drawing.Size(75, 23);
this.btnSubscript.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnSubscript.TabIndex = 9;
this.btnSubscript.Text = "Subscript";
this.btnSubscript.Click += new System.EventHandler(this.btnSubscript_Click);
//
// btnSuperscript
//
this.btnSuperscript.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnSuperscript.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnSuperscript.Location = new System.Drawing.Point(90, 42);
this.btnSuperscript.Name = "btnSuperscript";
this.btnSuperscript.Size = new System.Drawing.Size(75, 23);
this.btnSuperscript.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnSuperscript.TabIndex = 10;
this.btnSuperscript.Text = "Superscript";
this.btnSuperscript.Click += new System.EventHandler(this.btnSuperscript_Click);
//
// btnHardspace
//
this.btnHardspace.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnHardspace.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnHardspace.Location = new System.Drawing.Point(150, 10);
this.btnHardspace.Name = "btnHardspace";
this.btnHardspace.Size = new System.Drawing.Size(37, 26);
this.btnHardspace.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnHardspace.TabIndex = 11;
this.btnHardspace.Text = "HS";
this.btnHardspace.Click += new System.EventHandler(this.btnHardspace_Click);
//
// frmRtfEdit
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(282, 198);
this.Controls.Add(this.btnHardspace);
this.Controls.Add(this.btnSuperscript);
this.Controls.Add(this.btnSubscript);
this.Controls.Add(this.btnUnderline);
this.Controls.Add(this.btnItalics);
this.Controls.Add(this.btnBold);
this.Controls.Add(this.rtfBox);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOK);
this.Name = "frmRtfEdit";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Rich Text Edit";
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.RichTextBox rtfBox;
private DevComponents.DotNetBar.ButtonX btnBold;
private DevComponents.DotNetBar.ButtonX btnItalics;
private DevComponents.DotNetBar.ButtonX btnUnderline;
private DevComponents.DotNetBar.ButtonX btnSubscript;
private DevComponents.DotNetBar.ButtonX btnSuperscript;
private DevComponents.DotNetBar.ButtonX btnHardspace;
}
}

View File

@ -0,0 +1,199 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Text.RegularExpressions;
using DevComponents.DotNetBar;
namespace Volian.Base.Library
{
// this is the form used in the UCF (User Control of Format) feature that displays text and allows the user to modify it to
// add/remove various text attributes: Underline, bold, italics, super/sub script & Hard space.
public partial class frmRtfEdit : Form
{
public frmRtfEdit()
{
InitializeComponent();
}
private static Regex regHyphen = new Regex(@"(?<!\\)(\\u8208\?|\\u8210\?|\\u8211\?|\\u8212\?|\\u8213\?|\\_|\\endash|\\emdash)");
// Value is used by the UITypeEditor, RtfEditor, to set/return the text that is being edited.
public string Value
{
get
{
string rtbString = regHyphen.Replace(RtfToDbText(rtfBox.Rtf).Replace("<BackSlash>", "\\\\"), @"\u8209?");
int indx = rtbString.IndexOf('-');
while (indx > -1)
{
if (indx > 2)
{
if (rtbString[indx - 1] != 'i' || rtbString[indx - 2] != 'f' || rtbString[indx - 3] != '\\')
{
rtbString = rtbString.Remove(indx, 1);
rtbString = rtbString.Insert(indx, @"\u8209?");
}
if (indx + 1 > rtbString.Length) indx = -1;
else indx = rtbString.IndexOf('-', indx + 1);
}
}
return rtbString;
}
set
{
string makeRtf = @"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Microsoft Sans Serif;}}\viewkind4\uc1\pard\f0\fs16 " + value + @"\par}";
makeRtf = makeRtf.Replace(@"\xa0", "'");
rtfBox.Rtf = makeRtf;
}
}
// when saving text, keep all of the necessary rtf commands that are used to define the text attributes. The rest are removed
public static string StaticReplaceRTFClause(Match m)
{
try
{
string token = m.Groups[1].Value;
switch (token[1])
{
case '\\':
return token;
case 'u':
if (Regex.IsMatch(token, @"^\\u[0-9]+$"))
return token; // Special Charcaters
if (Regex.IsMatch(token, @"^\\ulnone ?$"))
return token;
if (Regex.IsMatch(token, @"^\\ul.*$"))
return token; // Underline
if (Regex.IsMatch(token, @"^\\up[0-9] ?$"))
return token; // shift up (superscript)
break;
case 'd':
if (Regex.IsMatch(token, @"^\\dn[0-9] ?$"))
return token; // shift down (subscript)
break;
case '\'': // Special Character
return token;
case 'b': // Bold
return token;
case 'i': // Italics
return token;
case '{': // look for escape for curly braces:
return token;
case '}':
return token;
case 'l':
if (Regex.IsMatch(token, @"^\\line ?$")) return token;
if (Regex.IsMatch(token, @"^\\li[-0-9]+ ?$")) return token; // line indent
break;
case 'f':
if (Regex.IsMatch(token, @"^\\fi[-0-9]+ ?$")) return token; // first line indent
break;
case 'p':
if (Regex.IsMatch(token, @"^\\par ?$")) return @"{\par}";
break;
}
}
catch (Exception ex)
{
Console.WriteLine("StaticReplaceRTFClause {0} - {1}", ex.GetType().Name, ex.Message);
}
return "";//Strip All
}
// remove all of the rtf commands that are not needed to define the attributes of text that are supported:
private static Regex reg1 = new Regex(@"\\par\r\n(?!\\)");
private static Regex reg2 = new Regex(@"[\r\n]", RegexOptions.Singleline); // Strip Carriage Returns and Newlines
private static Regex reg3 = new Regex(@"^\{(.*)\}$", RegexOptions.Singleline); // Strip Opening and Closing Braces
private static Regex reg4 = new Regex(@"\{[^{]*?\}", RegexOptions.Singleline); // Strip Clauses - remove anything from curly braces
private static Regex reg5 = new Regex(@"\{[^{]*?\}", RegexOptions.Singleline); // Strip Clauses - remove anything from curly braces
private static Regex reg6 = new Regex(@"(\\[^' \\?\r\n\t]+)(?=\\)"); // add space after token if followed by token
private static Regex reg7 = new Regex(@"(\\[^' \\?\r\n\t]+ )"); // take backslash xyz and evaluates them
private static Regex reg8 = new Regex(@"(\\[^' \\?\r\n\t]+) (?=\\)"); // remove space between tokens
private static Regex reg9 = new Regex(@"(\\[^' \\?\r\n\t]+) (?=\r\n)"); // remove space before /r/n
private static Regex reg10 = new Regex(@"(\\[0-9a-z]+)$"); // end of text attribute needs a 'space'
private string RtfToDbText(string rtf)
{
// replace \{ & \} with (![ & (!] respectively and then redo at end. The curly braces
// are rtf so were getting removed and/or not handled correctly.
string retval = rtf.Replace(@"\{", @" (![");
retval = retval.Replace(@"\}", @" (!]");
// remove carriage return/newlines after \par commands (these are introduced by rtb
// for hard returns, goes into rtb as \par and comes out as \par\r\n):
retval = reg1.Replace(retval, "\\par ");
retval = retval.Replace("\\v0\r\n", "\\v0 "); // Replace Carriage Return and Newline after comment
retval = reg2.Replace(retval, ""); // Strip Carriage Returns and Newlines
retval = reg3.Replace(retval, "$1"); // Strip Opening and Closing Braces
retval = reg4.Replace(retval, ""); // Strip Clauses - remove anything from curly braces
retval = reg5.Replace(retval, ""); // Strip Clauses - remove anything from curly braces
retval = reg6.Replace(retval, "$1 "); // add space after token if followed by token
retval = reg7.Replace(retval, new MatchEvaluator(StaticReplaceRTFClause)); // take backslash xyz and evaluates them
retval = reg8.Replace(retval, "$1"); // remove space between tokens
retval = reg9.Replace(retval, "$1"); // remove space before /r/n
if (retval.EndsWith(@"{\par}")) retval = retval.Remove(retval.Length - 6, 6);
retval = reg10.Replace(retval, "$1 ");
// remove \r\n at end of string if the string has 2 or more characters
if (retval.EndsWith("\r\n")) retval = retval.Remove(retval.Length - 2, 2);
if (retval.Length == 0) return "";
if (retval.EndsWith(@"\v")) retval = retval.Remove(retval.Length - 2, 2);
retval = retval.Replace(@" (![", @"\{");
retval = retval.Replace(@" (!]", @"\}");
retval = retval.Replace("`",@"\xA0");
return retval;
}
private void btnBold_Click(object sender, EventArgs e)
{
RTBAPI.ToggleBold(!RTBAPI.IsBold(rtfBox), rtfBox, rtfBox.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION);
btnBold.Checked = RTBAPI.IsBold(rtfBox);
}
private void btnItalics_Click(object sender, EventArgs e)
{
RTBAPI.ToggleItalic(!RTBAPI.IsItalic(rtfBox), rtfBox, rtfBox.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION);
btnItalics.Checked = RTBAPI.IsItalic(rtfBox);
}
private void btnUnderline_Click(object sender, EventArgs e)
{
RTBAPI.ToggleUnderline(!RTBAPI.IsUnderline(rtfBox), rtfBox, rtfBox.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION);
btnUnderline.Checked = RTBAPI.IsUnderline(rtfBox);
}
private void btnSubscript_Click(object sender, EventArgs e)
{
RTBAPI.ToggleSubscript(!RTBAPI.IsSubScript(rtfBox), rtfBox, rtfBox.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION);
btnSubscript.Checked = RTBAPI.IsSubScript(rtfBox);
}
private void btnSuperscript_Click(object sender, EventArgs e)
{
RTBAPI.ToggleSuperscript(!RTBAPI.IsSuperScript(rtfBox), rtfBox, rtfBox.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION);
btnSuperscript.Checked = RTBAPI.IsSuperScript(rtfBox);
}
private void btnOK_Click(object sender, EventArgs e)
{
}
private void btnCancel_Click(object sender, EventArgs e)
{
}
private void rtfBox_SelectionChanged(object sender, EventArgs e)
{
btnBold.Checked = RTBAPI.IsBold(rtfBox);
btnItalics.Checked = RTBAPI.IsItalic(rtfBox);
btnUnderline.Checked = RTBAPI.IsUnderline(rtfBox);
}
private void btnHardspace_Click(object sender, EventArgs e)
{
AddText("`");
}
private void AddText(string str)
{
// See comments in AddRtf(string str) to explain the font style setting
RTBAPI.E_FontStyle fs = RTBAPI.GetFontStyle(rtfBox);
int positionStart = rtfBox.SelectionStart;
rtfBox.SelectedText = str;
int positionAfter = rtfBox.SelectionStart;
rtfBox.Select(positionStart, positionAfter - positionStart);
RTBAPI.SetFontStyle(rtfBox, fs);
rtfBox.Select(positionAfter, 0);
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -270,7 +270,9 @@ namespace Volian.Controls.Library
bool _checkoffsAllowed = true;
if (fmtdata.ProcData.CheckOffData.CheckoffOnSubStepsOnly)
_checkoffsAllowed = cmbCheckoff.Enabled = CurItemInfo.IsType("Substep");
if (_checkoffsAllowed && !(fmtdata.ProcData.CheckOffData.CheckOffList == null) && !(fmtdata.ProcData.CheckOffData.CheckOffList.MaxIndex == 0))
int maxindx = fmtdata.ProcData.CheckOffUCF ? fmtdata.ProcData.CheckOffData.CheckOffList.MaxIndex : fmtdata.ProcData.CheckOffData.CheckOffList.MaxIndexNoInherit;
if (_checkoffsAllowed && !(fmtdata.ProcData.CheckOffData.CheckOffList == null) && !(maxindx == 0))
{
cmbCheckoff.Items.Clear();
foreach (CheckOff co in fmtdata.ProcData.CheckOffData.CheckOffList)
@ -280,14 +282,27 @@ namespace Volian.Controls.Library
// bug fix B2015-186
// the config had a really big number for the checkoff index.
// if that config number is greater than the number of items in the checkoff list, default to an index of zero
// for the ucf, add possibility of index >= 100 which flags a UCF index.
if (sc.Step_CheckOffIndex != -1)
cmbCheckoff.SelectedIndex = (sc.Step_CheckOffIndex <= cmbCheckoff.Items.Count - 1) ? sc.Step_CheckOffIndex : 0;
{
int cntindx = 0;
// find matching string & use its index:
foreach (CheckOff co in fmtdata.ProcData.CheckOffData.CheckOffList)
{
if (co.Index == sc.Step_CheckOffIndex)
{
cmbCheckoff.SelectedIndex = cntindx;
break;
}
cntindx++;
}
}
}
// if there are no checkoffs OR
// if this is a sign-off, the checkoff list is not enabled either (matches 16bit functionality) At some point, we
// may want to allow them to turn off the checkoff
// Catawba and McGuire formats use this
if (_checkoffsAllowed && (fmtdata.ProcData.CheckOffData.CheckOffList == null || fmtdata.ProcData.CheckOffData.CheckOffList.MaxIndex == 0) ||
if (_checkoffsAllowed && (fmtdata.ProcData.CheckOffData.CheckOffList == null || maxindx == 0) ||
fmtdata.ProcData.CheckOffData.Menu == "Signoff")
{
SectionConfig secf = CurItemInfo.ActiveSection.MyConfig as SectionConfig;
@ -638,6 +653,21 @@ namespace Volian.Controls.Library
MyEditItem.SaveContents();
// set selected index in the step's config.
int indx = cmbCheckoff.SelectedIndex;
// get index, if greater than 100, store that - otherwise store index down list.
// if this format does not have ucf signoffs, indx is just the selected index from the combo mobx.
if (CurItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffUCF)
{
// get index, if greater than 100, store that - otherwise store index down list.
// if this format does not have ucf signoffs, indx is just the selected index from the combo mobx.
foreach (CheckOff co in CurItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffList)
{
if (cmbCheckoff.SelectedItem == co.MenuItem)
{
if ((int)co.Index >= 100) indx = (int)co.Index;
break;
}
}
}
StepConfig sc = CurItemInfo.MyConfig as StepConfig;
sc.Step_CheckOffIndex = indx;
//using (Content cnt = Content.Get(CurItemInfo.MyContent.ContentID))

View File

@ -6,6 +6,7 @@ using System.Data;
using System.Text;
using System.Windows.Forms;
using VEPROMS.CSLA.Library;
using Volian.Base.Library;
namespace Volian.Controls.Library
{

View File

@ -52,7 +52,7 @@
//RTBAPI.SetLineSpacing(this._MyStepRTB, RTBAPI.ParaSpacing.PFS_DOUBLE);
// RTBAPI.SetSpaceAfter(this._MyStepRTB, 200);
RTBAPI.SetSpaceBefore(this._MyStepRTB, 20);
Volian.Base.Library.RTBAPI.SetSpaceBefore(this._MyStepRTB, 20);
//
// _MyStepRTB
//

View File

@ -0,0 +1,198 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<style>
body {
background-color: lightblue;
}
h1 {
color: white;
text-align: center;
font-size: 30px;
}
td {
font-family: verdana;
font-size: 14px;
padding: 2px;
}
th {
font-family: verdana;
font-size: 14px;
}
</style>
</head>
<body>
<h1>User Control of Format Differences</h1>
<xsl:for-each select="//FormatData/*">
<xsl:apply-templates select="."/>
</xsl:for-each>
<xsl:for-each select="//DocStyles">
<xsl:apply-templates select="."/>
</xsl:for-each>
</body>
</html>
</xsl:template>
<xsl:template match="Flags">
<xsl:if test="*">
<table border="1">
<tr bgcolor="#9acd32">
<th>Flag</th>
<th>Mode</th>
<th>Value</th>
</tr>
<xsl:for-each select="*">
<tr>
<td bgcolor="honeydew"><xsl:value-of select="name()"/></td>
<td bgcolor="lemonchiffon"><xsl:value-of select="@Mode"/></td>
<td bgcolor="lemonchiffon" align="right"><xsl:value-of select="."/></td>
</tr>
</xsl:for-each>
</table>
<p/>
</xsl:if>
</xsl:template>
<xsl:template match="CheckOffHeaderList">
<table border="1">
<tr bgcolor="#9acd32">
<th>Check Off Header Type</th>
<th>Active</th>
<th>Mode</th>
</tr>
<xsl:for-each select="CheckOffHeader">
<tr>
<td bgcolor="honeydew"><xsl:value-of select="@CheckOffHeading"/></td>
<td bgcolor="lemonchiffon" align="right"><xsl:value-of select="Active"/></td>
<td bgcolor="lemonchiffon" align="right"><xsl:value-of select="@Mode"/></td>
</tr>
</xsl:for-each>
</table>
<p/>
</xsl:template>
<xsl:template match="CheckOffList">
<table border="1">
<tr bgcolor="#9acd32">
<th>Check Off Type</th>
<th>Active</th>
<th>Mode</th>
</tr>
<xsl:for-each select="CheckOff">
<tr>
<td bgcolor="honeydew"><xsl:value-of select="@MenuItem"/></td>
<td bgcolor="lemonchiffon" align="right"><xsl:value-of select="Active"/></td>
<td bgcolor="lemonchiffon" align="right"><xsl:value-of select="@Mode"/></td>
</tr>
</xsl:for-each>
</table>
<p/>
</xsl:template>
<xsl:template match="CheckOffXOffAdj">
<table border="1">
<tr bgcolor="#9acd32">
<th>Check Off X Offset Adjust (In)</th>
<th>Mode</th>
</tr>
<tr>
<td bgcolor="lemonchiffon" align="right">
<xsl:value-of select="."/>
</td>
<td bgcolor="lemonchiffon" align="right">
<xsl:value-of select="@Mode"/>
</td>
</tr>
</table>
<p/>
</xsl:template>
<xsl:template match="ReplaceStrData">
<table border="1">
<tr bgcolor="#9acd32">
<th>Replace Word</th>
<th>Replace With</th>
<th>State</th>
<th>Flag</th>
</tr>
<xsl:for-each select="ReplaceStr">
<tr>
<td bgcolor="honeydew"><xsl:value-of select="@ReplaceWord"/></td>
<td bgcolor="lemonchiffon" align="right"><xsl:value-of select="@ReplaceWith"/></td>
<td bgcolor="lemonchiffon" align="right">
<xsl:choose>
<xsl:when test="@State = 1">
<xsl:text>Add</xsl:text>
</xsl:when>
<xsl:when test="@State = 2">
<xsl:text>Modify</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>Delete</xsl:text>
</xsl:otherwise>
</xsl:choose></td>
<td bgcolor="lemonchiffon" align="right"><xsl:value-of select="@Flag"/></td>
</tr>
</xsl:for-each>
</table>
<p/>
</xsl:template>
<xsl:template match="StepData">
<table border="1">
<tr bgcolor="#9acd32">
<th>Step Type</th>
<th>Font</th>
</tr>
<xsl:for-each select="Step">
<tr>
<td bgcolor="honeydew"><xsl:value-of select="@Type"/></td>
<style>
td {
font-family: <xsl:value-of select="FontDesc/@Family"/>;
}
</style>
<td bgcolor="lemonchiffon" align="right"><xsl:value-of select="FontDesc/@Font"/></td>
</tr>
<style>
td {
font-family: verdana;
font-size: 14px;
padding: 2px;
}
</style>
</xsl:for-each>
</table>
<p/>
</xsl:template>
<xsl:decimal-format name="coerce" NaN=" " />
<xsl:template match="DocStyles">
<table border="1">
<tr bgcolor="#9acd32">
<th>Document Style</th>
<th>Original Page Length</th>
<th>New Page Length</th>
<th>Original Left Margin</th>
<th>New Left Margin</th>
</tr>
<xsl:for-each select="DocStyle">
<tr>
<td bgcolor="honeydew"><xsl:value-of select="@Name"/></td>
<td bgcolor="lemonchiffon" align="right"><xsl:value-of select="format-number(Layout/@PageLengthOld div 72,'##.00','coerce')"/></td>
<td bgcolor="lemonchiffon" align="right"><xsl:value-of select="format-number(Layout/@PageLengthNew div 72,'##.00','coerce')"/></td>
<td bgcolor="lemonchiffon" align="right"><xsl:value-of select="format-number(Layout/@LeftMarginOld div 72,'##.00','coerce')"/></td>
<td bgcolor="lemonchiffon" align="right"><xsl:value-of select="format-number(Layout/@LeftMarginNew div 72,'##.00','coerce')"/></td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,189 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<style>
body {
background-color: lightblue;
}
h1 {
color: white;
text-align: center;
font-size: 30px;
}
td {
font-family: verdana;
font-size: 14px;
padding: 2px;
}
th {
font-family: verdana;
font-size: 14px;
}
</style>
</head>
<body>
<h4><xsl:value-of select="FormatConfig/@Version"/></h4>
<xsl:for-each select="//FormatData/*">
<xsl:apply-templates select="."/>
</xsl:for-each>
<xsl:for-each select="//DocStyles">
<xsl:apply-templates select="."/>
</xsl:for-each>
</body>
</html>
</xsl:template>
<xsl:template match="Flags">
<xsl:if test="*">
<table border="1">
<tr bgcolor="#9acd32">
<th>Flag</th>
<th>Value</th>
</tr>
<xsl:for-each select="*">
<tr>
<td bgcolor="honeydew"><xsl:value-of select="name()"/></td>
<td bgcolor="lemonchiffon" align="right"><xsl:value-of select="."/></td>
</tr>
</xsl:for-each>
</table>
<p/>
</xsl:if>
</xsl:template>
<xsl:template match="CheckOffHeaderList">
<table border="1">
<tr bgcolor="#9acd32">
<th>Check Off Heading</th>
<th>Active</th>
</tr>
<xsl:for-each select="CheckOffHeader">
<tr>
<td bgcolor="honeydew">
<xsl:value-of select="@CheckOffHeading"/>
</td>
<td bgcolor="lemonchiffon" align="right">
<xsl:value-of select="Active"/>
</td>
</tr>
</xsl:for-each>
</table>
<p/>
</xsl:template>
<xsl:template match="CheckOffList">
<table border="1">
<tr bgcolor="#9acd32">
<th>Check Off Type</th>
<th>Active</th>
</tr>
<xsl:for-each select="CheckOff">
<tr>
<td bgcolor="honeydew"><xsl:value-of select="@MenuItem"/></td>
<td bgcolor="lemonchiffon" align="right"><xsl:value-of select="Active"/></td>
</tr>
</xsl:for-each>
</table>
<p/>
</xsl:template>
<xsl:template match="CheckOffXOffAdj">
<table border="1">
<tr bgcolor="#9acd32">
<th>Check Off X Offset Adjust (Inches)</th>
</tr>
<tr>
<td bgcolor="lemonchiffon" align="right">
<xsl:value-of select="."/>
</td>
</tr>
</table>
<p/>
</xsl:template>
<xsl:template match="ReplaceStrData">
<table border="1">
<tr bgcolor="#9acd32">
<th>Replace Word</th>
<th>Replace With</th>
<th>State</th>
<th>Flag</th>
</tr>
<xsl:for-each select="ReplaceStr">
<tr>
<td bgcolor="honeydew"><xsl:value-of select="@ReplaceWord"/></td>
<td bgcolor="lemonchiffon" align="right"><xsl:value-of select="@ReplaceWith"/></td>
<td bgcolor="lemonchiffon" align="right">
<xsl:choose>
<xsl:when test="@State = 1">
<xsl:text>Add</xsl:text>
</xsl:when>
<xsl:when test="@State = 2">
<xsl:text>Modify</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>Delete</xsl:text>
</xsl:otherwise>
</xsl:choose></td>
<td bgcolor="lemonchiffon" align="right"><xsl:value-of select="@Flag"/></td>
</tr>
</xsl:for-each>
</table>
<p/>
</xsl:template>
<xsl:template match="StepData">
<table border="1">
<tr bgcolor="#9acd32">
<th>Step Type</th>
<th>Font</th>
</tr>
<xsl:for-each select="Step">
<tr>
<td bgcolor="honeydew"><xsl:value-of select="@Type"/></td>
<style>
td {
font-family: <xsl:value-of select="FontDesc/@Family"/>;
}
</style>
<td bgcolor="lemonchiffon" align="right"><xsl:value-of select="FontDesc/@Font"/></td>
</tr>
<style>
td {
font-family: verdana;
font-size: 14px;
padding: 2px;
}
</style>
</xsl:for-each>
</table>
<p/>
</xsl:template>
<xsl:decimal-format name="coerce" NaN=" " />
<xsl:template match="DocStyles">
<table border="1">
<tr bgcolor="#9acd32">
<th>Document Style</th>
<th>Page Length</th>
<th>Left Margin</th>
</tr>
<xsl:for-each select="DocStyle">
<tr>
<td bgcolor="honeydew"><xsl:value-of select="@Name"/></td>
<td bgcolor="lemonchiffon" align="right"><xsl:value-of select="format-number(Layout/@PageLength div 72,'##.00','coerce')"/></td>
<td bgcolor="lemonchiffon" align="right"><xsl:value-of select="format-number(Layout/@LeftMargin div 72,'##.00','coerce')"/></td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,397 @@
namespace Volian.Controls.Library
{
partial class dlgUCFImportOptions
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnOk = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.pnlOptions = new System.Windows.Forms.Panel();
this.pnlChoices = new System.Windows.Forms.Panel();
this.cmbFNames = new DevComponents.DotNetBar.Controls.ComboBoxEx();
this.grPnlLoad = new DevComponents.DotNetBar.Controls.GroupPanel();
this.grPnlUse = new DevComponents.DotNetBar.Controls.GroupPanel();
this.rbOnlyImported = new System.Windows.Forms.RadioButton();
this.rbAll = new System.Windows.Forms.RadioButton();
this.rbSetOnly = new System.Windows.Forms.RadioButton();
this.cbUse = new DevComponents.DotNetBar.Controls.CheckBoxX();
this.lblLoadFormat = new DevComponents.DotNetBar.LabelX();
this.sBtnLoad = new DevComponents.DotNetBar.Controls.SwitchButton();
this.lblFmt = new System.Windows.Forms.Label();
this.pnlXmlDiff = new System.Windows.Forms.Panel();
this.wbBrwsExisting = new System.Windows.Forms.WebBrowser();
this.splitterWebBrowsers = new System.Windows.Forms.Splitter();
this.pnlWbBrwsImp = new System.Windows.Forms.Panel();
this.wbBrwsImporting = new System.Windows.Forms.WebBrowser();
this.superTooltip1 = new DevComponents.DotNetBar.SuperTooltip();
this.pnlChoices.SuspendLayout();
this.grPnlLoad.SuspendLayout();
this.grPnlUse.SuspendLayout();
this.pnlXmlDiff.SuspendLayout();
this.pnlWbBrwsImp.SuspendLayout();
this.SuspendLayout();
//
// btnOk
//
this.btnOk.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnOk.Location = new System.Drawing.Point(31, 356);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(65, 23);
this.btnOk.TabIndex = 5;
this.btnOk.Text = "OK";
this.btnOk.UseVisualStyleBackColor = true;
this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
//
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(121, 356);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(65, 23);
this.btnCancel.TabIndex = 6;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
//
// pnlOptions
//
this.pnlOptions.Location = new System.Drawing.Point(0, 0);
this.pnlOptions.Name = "pnlOptions";
this.pnlOptions.Size = new System.Drawing.Size(200, 100);
this.pnlOptions.TabIndex = 0;
//
// pnlChoices
//
this.pnlChoices.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.pnlChoices.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pnlChoices.Controls.Add(this.cmbFNames);
this.pnlChoices.Controls.Add(this.grPnlLoad);
this.pnlChoices.Controls.Add(this.lblLoadFormat);
this.pnlChoices.Controls.Add(this.sBtnLoad);
this.pnlChoices.Controls.Add(this.lblFmt);
this.pnlChoices.Controls.Add(this.btnCancel);
this.pnlChoices.Controls.Add(this.btnOk);
this.pnlChoices.Location = new System.Drawing.Point(0, 0);
this.pnlChoices.Name = "pnlChoices";
this.pnlChoices.Size = new System.Drawing.Size(250, 606);
this.pnlChoices.TabIndex = 7;
//
// cmbFNames
//
this.cmbFNames.DisplayMember = "Text";
this.cmbFNames.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
this.cmbFNames.FormattingEnabled = true;
this.cmbFNames.ItemHeight = 16;
this.cmbFNames.Location = new System.Drawing.Point(26, 48);
this.cmbFNames.Name = "cmbFNames";
this.cmbFNames.Size = new System.Drawing.Size(191, 22);
this.cmbFNames.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.cmbFNames.TabIndex = 15;
this.cmbFNames.SelectedIndexChanged += new System.EventHandler(this.cmbFNames_SelectedIndexChanged);
//
// grPnlLoad
//
this.grPnlLoad.CanvasColor = System.Drawing.SystemColors.Control;
this.grPnlLoad.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
this.grPnlLoad.Controls.Add(this.grPnlUse);
this.grPnlLoad.Controls.Add(this.cbUse);
this.grPnlLoad.DisabledBackColor = System.Drawing.Color.Empty;
this.grPnlLoad.Location = new System.Drawing.Point(11, 130);
this.grPnlLoad.Name = "grPnlLoad";
this.grPnlLoad.Size = new System.Drawing.Size(224, 184);
//
//
//
this.grPnlLoad.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2;
this.grPnlLoad.Style.BackColorGradientAngle = 90;
this.grPnlLoad.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground;
this.grPnlLoad.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.grPnlLoad.Style.BorderBottomWidth = 1;
this.grPnlLoad.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.grPnlLoad.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.grPnlLoad.Style.BorderLeftWidth = 1;
this.grPnlLoad.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.grPnlLoad.Style.BorderRightWidth = 1;
this.grPnlLoad.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.grPnlLoad.Style.BorderTopWidth = 1;
this.grPnlLoad.Style.CornerDiameter = 4;
this.grPnlLoad.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded;
this.grPnlLoad.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center;
this.grPnlLoad.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
this.grPnlLoad.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near;
//
//
//
this.grPnlLoad.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square;
//
//
//
this.grPnlLoad.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.grPnlLoad.TabIndex = 14;
this.grPnlLoad.Text = "Load Options";
//
// grPnlUse
//
this.grPnlUse.BackColor = System.Drawing.Color.Transparent;
this.grPnlUse.CanvasColor = System.Drawing.SystemColors.Control;
this.grPnlUse.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
this.grPnlUse.Controls.Add(this.rbOnlyImported);
this.grPnlUse.Controls.Add(this.rbAll);
this.grPnlUse.Controls.Add(this.rbSetOnly);
this.grPnlUse.DisabledBackColor = System.Drawing.Color.Empty;
this.grPnlUse.Location = new System.Drawing.Point(15, 39);
this.grPnlUse.Name = "grPnlUse";
this.grPnlUse.Size = new System.Drawing.Size(181, 119);
//
//
//
this.grPnlUse.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2;
this.grPnlUse.Style.BackColorGradientAngle = 90;
this.grPnlUse.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground;
this.grPnlUse.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.grPnlUse.Style.BorderBottomWidth = 1;
this.grPnlUse.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.grPnlUse.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.grPnlUse.Style.BorderLeftWidth = 1;
this.grPnlUse.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.grPnlUse.Style.BorderRightWidth = 1;
this.grPnlUse.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.grPnlUse.Style.BorderTopWidth = 1;
this.grPnlUse.Style.CornerDiameter = 4;
this.grPnlUse.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded;
this.grPnlUse.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center;
this.grPnlUse.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
this.grPnlUse.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near;
//
//
//
this.grPnlUse.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square;
//
//
//
this.grPnlUse.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.grPnlUse.TabIndex = 1;
this.grPnlUse.Text = "In Procedure(s)";
//
// rbOnlyImported
//
this.rbOnlyImported.AutoSize = true;
this.rbOnlyImported.BackColor = System.Drawing.Color.Transparent;
this.rbOnlyImported.Location = new System.Drawing.Point(12, 6);
this.rbOnlyImported.Name = "rbOnlyImported";
this.rbOnlyImported.Size = new System.Drawing.Size(142, 21);
this.superTooltip1.SetSuperTooltip(this.rbOnlyImported, new DevComponents.DotNetBar.SuperTooltipInfo("For Imported Only", "", "The changed UCF will only be used by the procedure(s) that are being imported.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray));
this.rbOnlyImported.TabIndex = 5;
this.rbOnlyImported.TabStop = true;
this.rbOnlyImported.Text = "For Imported Only";
this.rbOnlyImported.UseVisualStyleBackColor = false;
//
// rbAll
//
this.rbAll.AutoSize = true;
this.rbAll.BackColor = System.Drawing.Color.Transparent;
this.rbAll.Location = new System.Drawing.Point(12, 33);
this.rbAll.Name = "rbAll";
this.rbAll.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.rbAll.Size = new System.Drawing.Size(69, 21);
this.superTooltip1.SetSuperTooltip(this.rbAll, new DevComponents.DotNetBar.SuperTooltipInfo("For All ", "", "The changed UCF will be used in all procedure(s) and section(s) within the databa" +
"se that referenced this UCF. The one that existed in the database will be renam" +
"ed to \'Old N of UCFname\'.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray));
this.rbAll.TabIndex = 6;
this.rbAll.TabStop = true;
this.rbAll.Text = "For All";
this.rbAll.UseVisualStyleBackColor = false;
//
// rbSetOnly
//
this.rbSetOnly.AutoSize = true;
this.rbSetOnly.BackColor = System.Drawing.Color.Transparent;
this.rbSetOnly.Location = new System.Drawing.Point(12, 60);
this.rbSetOnly.Name = "rbSetOnly";
this.rbSetOnly.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.rbSetOnly.Size = new System.Drawing.Size(108, 21);
this.superTooltip1.SetSuperTooltip(this.rbSetOnly, new DevComponents.DotNetBar.SuperTooltipInfo("For Set Only", "", "The changed UCF will only be used by the procedure(s)/sections(s) within the proc" +
"edure set that this procedure belongs.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray));
this.rbSetOnly.TabIndex = 7;
this.rbSetOnly.TabStop = true;
this.rbSetOnly.Text = "For Set Only";
this.rbSetOnly.UseVisualStyleBackColor = false;
//
// cbUse
//
this.cbUse.BackColor = System.Drawing.Color.Transparent;
//
//
//
this.cbUse.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.cbUse.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cbUse.Location = new System.Drawing.Point(17, 5);
this.cbUse.Name = "cbUse";
this.cbUse.Size = new System.Drawing.Size(125, 28);
this.cbUse.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.superTooltip1.SetSuperTooltip(this.cbUse, new DevComponents.DotNetBar.SuperTooltipInfo("Use", "", "If checked, the changes will be used as defined In Procedure(s) below. Otherwise," +
" the format is loaded but not used. ", null, null, DevComponents.DotNetBar.eTooltipColor.Gray));
this.cbUse.TabIndex = 0;
this.cbUse.Text = "Use";
this.cbUse.CheckedChanged += new System.EventHandler(this.cbUse_CheckedChanged);
//
// lblLoadFormat
//
//
//
//
this.lblLoadFormat.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.lblLoadFormat.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblLoadFormat.Location = new System.Drawing.Point(124, 89);
this.lblLoadFormat.Name = "lblLoadFormat";
this.lblLoadFormat.Size = new System.Drawing.Size(94, 24);
this.superTooltip1.SetSuperTooltip(this.lblLoadFormat, new DevComponents.DotNetBar.SuperTooltipInfo("Load Format", "", "The User Control of Format changes will be loaded (imported) into the database. O" +
"therwise it will be ignored and the existing User Control of Format will be used" +
".", null, null, DevComponents.DotNetBar.eTooltipColor.Gray));
this.lblLoadFormat.TabIndex = 13;
this.lblLoadFormat.Text = "Load Format";
//
// sBtnLoad
//
this.sBtnLoad.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.sBtnLoad.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.sBtnLoad.Location = new System.Drawing.Point(13, 88);
this.sBtnLoad.Name = "sBtnLoad";
this.sBtnLoad.Size = new System.Drawing.Size(102, 26);
this.sBtnLoad.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.sBtnLoad.TabIndex = 12;
this.sBtnLoad.ValueChanged += new System.EventHandler(this.sBtnLoad_ValueChanged);
//
// lblFmt
//
this.lblFmt.AutoSize = true;
this.lblFmt.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblFmt.Location = new System.Drawing.Point(16, 19);
this.lblFmt.Name = "lblFmt";
this.lblFmt.Size = new System.Drawing.Size(140, 18);
this.lblFmt.TabIndex = 8;
this.lblFmt.Text = "Changes to Format:";
//
// pnlXmlDiff
//
this.pnlXmlDiff.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pnlXmlDiff.Controls.Add(this.wbBrwsExisting);
this.pnlXmlDiff.Controls.Add(this.splitterWebBrowsers);
this.pnlXmlDiff.Controls.Add(this.pnlWbBrwsImp);
this.pnlXmlDiff.Location = new System.Drawing.Point(255, 0);
this.pnlXmlDiff.Name = "pnlXmlDiff";
this.pnlXmlDiff.Size = new System.Drawing.Size(548, 601);
this.pnlXmlDiff.TabIndex = 8;
//
// wbBrwsExisting
//
this.wbBrwsExisting.Dock = System.Windows.Forms.DockStyle.Fill;
this.wbBrwsExisting.Location = new System.Drawing.Point(0, 0);
this.wbBrwsExisting.MinimumSize = new System.Drawing.Size(20, 20);
this.wbBrwsExisting.Name = "wbBrwsExisting";
this.wbBrwsExisting.Size = new System.Drawing.Size(548, 298);
this.wbBrwsExisting.TabIndex = 0;
//
// splitterWebBrowsers
//
this.splitterWebBrowsers.Dock = System.Windows.Forms.DockStyle.Bottom;
this.splitterWebBrowsers.Location = new System.Drawing.Point(0, 298);
this.splitterWebBrowsers.Name = "splitterWebBrowsers";
this.splitterWebBrowsers.Size = new System.Drawing.Size(548, 3);
this.splitterWebBrowsers.TabIndex = 2;
this.splitterWebBrowsers.TabStop = false;
//
// pnlWbBrwsImp
//
this.pnlWbBrwsImp.Controls.Add(this.wbBrwsImporting);
this.pnlWbBrwsImp.Dock = System.Windows.Forms.DockStyle.Bottom;
this.pnlWbBrwsImp.Location = new System.Drawing.Point(0, 301);
this.pnlWbBrwsImp.Name = "panel1";
this.pnlWbBrwsImp.Size = new System.Drawing.Size(548, 300);
this.pnlWbBrwsImp.TabIndex = 3;
//
// wbBrwsImporting
//
this.wbBrwsImporting.Dock = System.Windows.Forms.DockStyle.Fill;
this.wbBrwsImporting.Location = new System.Drawing.Point(0, 0);
this.wbBrwsImporting.MinimumSize = new System.Drawing.Size(20, 20);
this.wbBrwsImporting.Name = "wbBrwsImporting";
this.wbBrwsImporting.Size = new System.Drawing.Size(548, 300);
this.wbBrwsImporting.TabIndex = 0;
//
// superTooltip1
//
this.superTooltip1.DefaultTooltipSettings = new DevComponents.DotNetBar.SuperTooltipInfo("", "", "", null, null, DevComponents.DotNetBar.eTooltipColor.Gray);
this.superTooltip1.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F";
//
// dlgUCFImportOptions
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(803, 606);
this.Controls.Add(this.pnlXmlDiff);
this.Controls.Add(this.pnlChoices);
this.Name = "dlgUCFImportOptions";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "User Control Of Format - Import Options";
this.pnlChoices.ResumeLayout(false);
this.pnlChoices.PerformLayout();
this.grPnlLoad.ResumeLayout(false);
this.grPnlUse.ResumeLayout(false);
this.grPnlUse.PerformLayout();
this.pnlXmlDiff.ResumeLayout(false);
this.pnlWbBrwsImp.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button btnOk;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Panel pnlOptions;
private System.Windows.Forms.Panel pnlXmlDiff;
private System.Windows.Forms.WebBrowser wbBrwsExisting;
private System.Windows.Forms.Panel pnlChoices;
private System.Windows.Forms.Label lblFmt;
private DevComponents.DotNetBar.LabelX lblLoadFormat;
private DevComponents.DotNetBar.Controls.SwitchButton sBtnLoad;
private DevComponents.DotNetBar.Controls.GroupPanel grPnlLoad;
private DevComponents.DotNetBar.Controls.GroupPanel grPnlUse;
private DevComponents.DotNetBar.Controls.CheckBoxX cbUse;
private System.Windows.Forms.RadioButton rbOnlyImported;
private System.Windows.Forms.RadioButton rbAll;
private System.Windows.Forms.RadioButton rbSetOnly;
private DevComponents.DotNetBar.SuperTooltip superTooltip1;
private DevComponents.DotNetBar.Controls.ComboBoxEx cmbFNames;
private System.Windows.Forms.Splitter splitterWebBrowsers;
private System.Windows.Forms.Panel pnlWbBrwsImp;
private System.Windows.Forms.WebBrowser wbBrwsImporting;
}
}

View File

@ -0,0 +1,184 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using System.Xml.Linq;
using System.Xml.Xsl;
using System.IO;
using Microsoft.XmlDiffPatch;
using VEPROMS.CSLA.Library;
namespace Volian.Controls.Library
{
// This dialog is used when the imported UCF is different than one existing in the database. It allows the user to
// select whether to overwrite, copy, etc. See the user interface project/dlgExportImport.cs for the options.
public partial class dlgUCFImportOptions : Form
{
List<string>ExistingFC;
List<string>ImportedFC;
private bool _Initializing = false;
public E_UCFImportOptions UCFImportOptionsCase = E_UCFImportOptions.LoadOnlyImported;
public dlgUCFImportOptions(List<string> name, List<string> existingFC, List<string> importedFC, E_UCFImportOptions defImpOpt, string xmlpath)
{
_Initializing = true;
InitializeComponent();
InitializeFNamesCombo(name);
ExistingFC = existingFC;
ImportedFC = importedFC;
cmbFNames.SelectedIndex = 0; // this displays the web browser differences for first name in the combo box.
// initialize the import of UCF option radio buttons:
UCFImportOptionsCase = defImpOpt;
rbSetOnly.Visible = !xmlpath.ToLower().Contains("folder");
if (defImpOpt == E_UCFImportOptions.Ignore)
{
sBtnLoad.Value = false;
grPnlLoad.Enabled = false;
grPnlUse.Enabled = false;
}
else if (defImpOpt == E_UCFImportOptions.LoadNotUsed)
{
sBtnLoad.Value = true;
grPnlLoad.Enabled = true;
cbUse.Checked = false;
grPnlUse.Enabled = false;
}
else if (defImpOpt == E_UCFImportOptions.LoadOnlyImported)
{
sBtnLoad.Value = true;
grPnlLoad.Enabled = true;
cbUse.Checked = true;
grPnlUse.Enabled = true;
rbOnlyImported.Checked = true;
}
else if (defImpOpt == E_UCFImportOptions.LoadUseAll)
{
sBtnLoad.Value = true;
grPnlLoad.Enabled = true;
cbUse.Checked = true;
grPnlUse.Enabled = true;
rbAll.Checked = true;
}
else if (defImpOpt == E_UCFImportOptions.LoadForSetOnly)
{
sBtnLoad.Value = true;
grPnlLoad.Enabled = true;
cbUse.Checked = true;
grPnlUse.Enabled = true;
rbSetOnly.Checked = true;
}
_Initializing = false;
return;
}
private void InitializeFNamesCombo(List<string> name)
{
foreach (string str in name)
cmbFNames.Items.Add(str);
}
private void DisplayXmlDiff(string existingFC, string importedFC)
{
XmlDocument xd = new XmlDocument();
xd.LoadXml(existingFC);
XmlNodeList xnl = xd.GetElementsByTagName("FormatConfig");
if (xnl != null && xnl.Count > 0) AddAttribute(xnl[0], "Version", "Existing");
string sXSLSummary = System.IO.File.ReadAllText(Application.StartupPath + "\\" + "UCFImpDetails.xsl");
StringWriter sw = new StringWriter();
StringWriter xsw = new StringWriter();
using (XmlReader xrt = XmlReader.Create(new StringReader(sXSLSummary)))
{
XmlTextWriter tx = new XmlTextWriter(xsw);
xd.WriteTo(tx);
string tmp = sw.ToString();
tmp = xd.InnerXml;
using (XmlReader xri = XmlReader.Create(new StringReader(tmp)))
{
using (XmlWriter xwo = XmlWriter.Create(sw))
{
XslCompiledTransform xsl = new XslCompiledTransform();
xsl.Load(xrt);
xsl.Transform(xri, xwo); // Perform Transform
}
wbBrwsExisting.DocumentText = sw.ToString();
}
}
StringWriter sw1 = new StringWriter();
StringWriter xsw1 = new StringWriter();
XmlDocument xd1 = new XmlDocument();
xd1.LoadXml(importedFC);
xnl = xd1.GetElementsByTagName("FormatConfig");
if (xnl != null && xnl.Count > 0) AddAttribute(xnl[0], "Version", "Importing");
using (XmlReader xrt = XmlReader.Create(new StringReader(sXSLSummary)))
{
XmlTextWriter tx = new XmlTextWriter(xsw1);
xd1.WriteTo(tx);
string tmp = xd1.InnerXml;
using (XmlReader xri = XmlReader.Create(new StringReader(tmp)))
{
using (XmlWriter xwo = XmlWriter.Create(sw1))
{
XslCompiledTransform xsl = new XslCompiledTransform();
xsl.Load(xrt);
xsl.Transform(xri, xwo); // Perform Transform
}
wbBrwsImporting.DocumentText = sw1.ToString();
}
}
}
private void AddAttribute(XmlNode xn, string name, string value)
{
XmlAttribute xa = xn.OwnerDocument.CreateAttribute(name);
xa.Value = value.ToString();
xn.Attributes.Append(xa);
}
private void btnOk_Click(object sender, EventArgs e)
{
if (!sBtnLoad.Value) UCFImportOptionsCase = E_UCFImportOptions.Ignore;
else if (!cbUse.Checked) UCFImportOptionsCase = E_UCFImportOptions.LoadNotUsed;
else if (rbOnlyImported.Checked) UCFImportOptionsCase = E_UCFImportOptions.LoadOnlyImported;
else if (rbAll.Checked) UCFImportOptionsCase = E_UCFImportOptions.LoadUseAll;
else if (rbSetOnly.Checked) UCFImportOptionsCase = E_UCFImportOptions.LoadForSetOnly;
this.Close();
}
private void sBtnLoad_ValueChanged(object sender, EventArgs e) // Import options for UCF Change: Load switch button
{
if (_Initializing) return;
if (sBtnLoad.Value)
{
grPnlLoad.Enabled = true; // Import the ucf change. let user select whether to use it.
grPnlUse.Enabled = false;
cbUse.Checked = false;
}
else
{
grPnlLoad.Enabled = false; // Don't import the ucf change.
grPnlUse.Enabled = false;
}
}
private void cbUse_CheckedChanged(object sender, EventArgs e) // Import options for UCF Change: use checkbox
{
if (_Initializing) return;
if (cbUse.Checked)
grPnlUse.Enabled = true; // Use the change. enable the load group & select for imported only
else
grPnlUse.Enabled = false; // Don't use the change.
}
private void cmbFNames_SelectedIndexChanged(object sender, EventArgs e)
{
int indx = cmbFNames.SelectedIndex;
string existingFC = ExistingFC[indx];
string importedFC = ImportedFC[indx];
DisplayXmlDiff(existingFC, importedFC);
}
}
}

View File

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="superTooltip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="wbBrwsExisting.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View File

@ -1027,7 +1027,8 @@ i = 0;
//}
VEPROMS.CSLA.Library.FormatInfo activeFormat = mySection.ActiveFormat;
VEPROMS.CSLA.Library.DocStyle docStyle = mySection.MyDocStyle;
Volian.Svg.Library.Svg mySvg = null;
Volian.Svg.Library.Svg mySvg = null;
// the following line fills in the svg/svggroup/svgparts for all that is defined in the genmac definition (svg for plant)
mySvg = SvgSerializer<Volian.Svg.Library.Svg>.StringDeserialize(BuildMyText(activeFormat));
mySvg.ViewBox.Height = 1100;
mySvg.ViewBox.Width = 850;
@ -1209,6 +1210,31 @@ i = 0;
private string BuildMyText(VEPROMS.CSLA.Library.FormatInfo activeFormat)
{
string sGenMac = activeFormat.GenMac;
FormatInfo fibase = activeFormat;
// If this format has checkoffs (go through docstyles to see if any sections 'usecheckoffs'), then see if the ucf checkoffs are
// defined in the format's genmac:
string sGenMacBase = null;
foreach (DocStyle ds in activeFormat.PlantFormat.DocStyles.DocStyleList)
{
if (ds.Inactive == false && ds.UseCheckOffs && !sGenMac.ToUpper().Contains("C100"))
{
while (fibase.FormatID != fibase.ParentID) fibase = fibase.MyParent;
sGenMacBase = fibase.GenMac;
if (sGenMacBase != null && sGenMacBase != "")
{
XmlDocument xDocGenMacBase = new XmlDocument();
xDocGenMacBase.LoadXml(sGenMacBase);
sGenMacBase = xDocGenMacBase.DocumentElement.InnerXml;
sGenMacBase = sGenMacBase.Replace("xmlns=\"http://www.w3.org/2000/svg\"", "");
// replace fonts with hls fontname & size
string bsfontfamily = activeFormat.PlantFormat.FormatData.StepDataList[0].Font.Family;
string bsfontsize = activeFormat.PlantFormat.FormatData.StepDataList[0].Font.Size.ToString();
sGenMacBase = sGenMacBase.Replace("{family}", bsfontfamily);
sGenMacBase = sGenMacBase.Replace("{size}", bsfontsize);
break;
}
}
}
if (sGenMac == null || sGenMac == "")
{
// If subformat and does not have its own genmac, find an inherited genmac.
@ -1219,7 +1245,11 @@ i = 0;
tmpf = FormatInfo.Get(tmpf.ParentID);
}
if (sGenMac == null || sGenMac == "")
sGenMac = "<svg/>";// return "";
sGenMac = "<svg></svg>";
}
if (sGenMacBase != null && sGenMacBase != "")
{
sGenMac = sGenMac.Replace("</svg>", sGenMacBase + "</svg>");
}
if (!sGenMac.Contains("xmlns"))
sGenMac = sGenMac.Replace("<svg ", "<svg xmlns='http://www.w3.org/2000/svg' ");

View File

@ -4138,6 +4138,13 @@ namespace Volian.Print.Library
xloc_co = XOffset + (relX > 0 ? Width : 0) + relX;
}
}
// if there is ucf value for adjusting the alignment for checkoffs, use it:
FormatConfig fc = PlantFormat.GetFormatConfig(formatInfo);
if (fc != null && fc.PlantFormat.FormatData.CheckOffXOffAdj != null)
{
if (co.Index > 99) xloc_co += ((float)fc.PlantFormat.FormatData.CheckOffXOffAdj * 72);
}
// CheckOffXtraLines was introduced for the additional lines needed for the longer signoffs
// for VCBA (&WST1), for F2016-061.
float checkOffNumberOfLines = (co.CheckOffNumberOfLines ?? 0);
@ -4823,7 +4830,8 @@ namespace Volian.Print.Library
// First see if there is any checkoff data in the format file and that there
// is a pagelist item for the checkoff header.
if (itemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffList.MaxIndex <= 0) return;
int maxindx = itemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffUCF ? itemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffList.MaxIndex : itemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffList.MaxIndexNoInherit;
if (maxindx <= 0) return;
if (MyPageHelper.PageListCheckOffHeader == null) return;
VE_Font font = null;