Added reference to System.Xml to DocVersionConfig class

Added Unit_Count property to DocVersionConfig class
Added SelectedSlave property to DocVersionConfig class
Changed Unit_Number property of DocVersionConfig class to support multi units
Added Old_Index property to DocVersionConfig class
Changed Other_Unit_Number property of DocVersionConfig class to support multi units
Changed Unit_Name property of DocVersionConfig class to support multi units
Changed Other_Unit_Name property of DocVersionConfig class to support 	multi units
Changed Unit_Text property of DocVersionConfig class to support multi units
Changed Other_Unit_Text property of DocVersionConfig class to support multi units
Changed Unit_ID property of DocVersionConfig class to support multi units
Changed Other_Unit_ID property of DocVersionConfig class to support multi units
Changed Unit_ProcedureNumber property of DocVersionConfig class to support multi units
Added Unit_ProcedureSetName property to DocVersionConfig class
Added Unit_ProcedureSetID property to DocVersionConfig class
Added AddSlave method to DocVersionConfig class
This commit is contained in:
Rich 2012-12-04 22:52:05 +00:00
parent ca9e68163e
commit 4f8e69d232

View File

@ -4,6 +4,7 @@ using System.Text;
using System.ComponentModel;
using System.Drawing;
using DescriptiveEnum;
using System.Xml;
namespace VEPROMS.CSLA.Library
{
@ -758,6 +759,25 @@ namespace VEPROMS.CSLA.Library
}
#endregion
#region Unit // From PROC.INI
//MultiUnitCount
[Category("Unit")]
[DisplayName("Unit Count")]
[RefreshProperties(RefreshProperties.All)]
[Description("Number of Units")]
public int Unit_Count
{
get
{
return _Xp.XmlContents.SelectNodes("//Slave").Count;
}
}
private int _SelectedSlave = 0;
//[Browsable(false)]
public int SelectedSlave
{
get { return _SelectedSlave; }
set { _SelectedSlave = value; }//Volian.Base.Library.vlnStackTrace.ShowStackLocal("SelectedSlave = {0}", _SelectedSlave.ToString()); }
}
[Category("Unit")]
[DisplayName("Unit Number")]
[RefreshProperties(RefreshProperties.All)]
@ -767,34 +787,31 @@ namespace VEPROMS.CSLA.Library
get
{
string s = _Xp["Unit", "Number"];// get the saved value
//If there is no value to get, then get the parent value (a.k.a. default value).
if (s == string.Empty)
s = _Xp.ParentValue("Unit", "Number"); // get the parent value
// If there is no parent value, then use the volian default
if (s == string.Empty)
return s = "";// default to volian default
if (SelectedSlave > 0)
s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "Number"];
return s;
}
set
{
// if value being saved is same as the parent value, then clear the value (save blank). This will
// reset the data to use the parent value.
string parval = _Xp.ParentValue("Unit", "Number"); // get the parent value
if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default
parval = "";
if (parval.Equals(value))
_Xp["Unit", "Number"] = string.Empty; // reset to parent value
if (SelectedSlave > 0)
_Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "Number"] = value; // save selected value
else
_Xp["Unit", "Number"] = value; // save selected value
_Xp["Unit", "Number"] = value;
OnPropertyChanged("Unit_Number");
}
}
[Browsable(false)]
public string Old_Index
{
get
{
string s = "";
if (SelectedSlave > 0)
s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "oldindex"];
return s;
}
}
[Category("Unit")]
[DisplayName("Other Unit Number")]
[RefreshProperties(RefreshProperties.All)]
@ -804,31 +821,16 @@ namespace VEPROMS.CSLA.Library
get
{
string s = _Xp["Unit", "OtherNumber"];// get the saved value
//If there is no value to get, then get the parent value (a.k.a. default value).
if (s == string.Empty)
s = _Xp.ParentValue("Unit", "OtherNumber"); // get the parent value
// If there is no parent value, then use the volian default
if (s == string.Empty)
return s = "";// default to volian default
if (SelectedSlave > 0)
s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "OtherNumber"];
return s;
}
set
{
// if value being saved is same as the parent value, then clear the value (save blank). This will
// reset the data to use the parent value.
string parval = _Xp.ParentValue("Unit", "OtherNumber"); // get the parent value
if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default
parval = "";
if (parval.Equals(value))
_Xp["Unit", "OtherNumber"] = string.Empty; // reset to parent value
if (SelectedSlave > 0)
_Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "OtherNumber"] = value; // save selected value
else
_Xp["Unit", "OtherNumber"] = value; // save selected value
_Xp["Unit", "OtherNumber"] = value;
OnPropertyChanged("Other_Unit_Number");
}
}
@ -841,31 +843,16 @@ namespace VEPROMS.CSLA.Library
get
{
string s = _Xp["Unit", "Name"];// get the saved value
//If there is no value to get, then get the parent value (a.k.a. default value).
if (s == string.Empty)
s = _Xp.ParentValue("Unit", "Name"); // get the parent value
// If there is no parent value, then use the volian default
if (s == string.Empty)
return s = "";// default to volian default
if (SelectedSlave > 0)
s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "Name"];
return s;
}
set
{
// if value being saved is same as the parent value, then clear the value (save blank). This will
// reset the data to use the parent value.
string parval = _Xp.ParentValue("Unit", "Name"); // get the parent value
if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default
parval = "";
if (parval.Equals(value))
_Xp["Unit", "Name"] = string.Empty; // reset to parent value
if (SelectedSlave > 0)
_Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "Name"] = value; // save selected value
else
_Xp["Unit", "Name"] = value; // save selected value
_Xp["Unit", "Name"] = value;
OnPropertyChanged("Unit_Name");
}
}
@ -878,32 +865,17 @@ namespace VEPROMS.CSLA.Library
get
{
string s = _Xp["Unit", "OtherName"];// get the saved value
//If there is no value to get, then get the parent value (a.k.a. default value).
if (s == string.Empty)
s = _Xp.ParentValue("Unit", "OtherName"); // get the parent value
// If there is no parent value, then use the volian default
if (s == string.Empty)
return s = "";// default to volian default
if (SelectedSlave > 0)
s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "OtherName"];
return s;
}
set
{
// if value being saved is same as the parent value, then clear the value (save blank). This will
// reset the data to use the parent value.
string parval = _Xp.ParentValue("Unit", "OtherName"); // get the parent value
if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default
parval = "";
if (parval.Equals(value))
_Xp["Unit", "OtherName"] = string.Empty; // reset to parent value
if (SelectedSlave > 0)
_Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "OtherName"] = value; // save selected value
else
_Xp["Unit", "OtherName"] = value; // save selected value
OnPropertyChanged("Unit_OtherName");
_Xp["Unit", "OtherName"] = value;
OnPropertyChanged("Other_Unit_Name");
}
}
[Category("Unit")]
@ -915,31 +887,16 @@ namespace VEPROMS.CSLA.Library
get
{
string s = _Xp["Unit", "Text"];// get the saved value
//If there is no value to get, then get the parent value (a.k.a. default value).
if (s == string.Empty)
s = _Xp.ParentValue("Unit", "Text"); // get the parent value
// If there is no parent value, then use the volian default
if (s == string.Empty)
return s = "";// default to volian default
if (SelectedSlave > 0)
s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "Text"];
return s;
}
set
{
// if value being saved is same as the parent value, then clear the value (save blank). This will
// reset the data to use the parent value.
string parval = _Xp.ParentValue("Unit", "Text"); // get the parent value
if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default
parval = "";
if (parval.Equals(value))
_Xp["Unit", "Text"] = string.Empty; // reset to parent value
if (SelectedSlave > 0)
_Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "Text"] = value; // save selected value
else
_Xp["Unit", "Text"] = value; // save selected value
_Xp["Unit", "Text"] = value;
OnPropertyChanged("Unit_Text");
}
}
@ -952,32 +909,17 @@ namespace VEPROMS.CSLA.Library
get
{
string s = _Xp["Unit", "OtherText"];// get the saved value
//If there is no value to get, then get the parent value (a.k.a. default value).
if (s == string.Empty)
s = _Xp.ParentValue("Unit", "OtherText"); // get the parent value
// If there is no parent value, then use the volian default
if (s == string.Empty)
return s = "";// default to volian default
if (SelectedSlave > 0)
s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "OtherText"];
return s;
}
set
{
// if value being saved is same as the parent value, then clear the value (save blank). This will
// reset the data to use the parent value.
string parval = _Xp.ParentValue("Unit", "OtherText"); // get the parent value
if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default
parval = "";
if (parval.Equals(value))
_Xp["Unit", "OtherText"] = string.Empty; // reset to parent value
if (SelectedSlave > 0)
_Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "OtherText"] = value; // save selected value
else
_Xp["Unit", "OtherText"] = value; // save selected value
OnPropertyChanged("Unit_OtherText");
_Xp["Unit", "OtherText"] = value;
OnPropertyChanged("Other_Unit_Text");
}
}
[Category("Unit")]
@ -989,31 +931,16 @@ namespace VEPROMS.CSLA.Library
get
{
string s = _Xp["Unit", "ID"];// get the saved value
//If there is no value to get, then get the parent value (a.k.a. default value).
if (s == string.Empty)
s = _Xp.ParentValue("Unit", "ID"); // get the parent value
// If there is no parent value, then use the volian default
if (s == string.Empty)
return s = "";// default to volian default
if (SelectedSlave > 0)
s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "ID"];
return s;
}
set
{
// if value being saved is same as the parent value, then clear the value (save blank). This will
// reset the data to use the parent value.
string parval = _Xp.ParentValue("Unit", "ID"); // get the parent value
if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default
parval = "";
if (parval.Equals(value))
_Xp["Unit", "ID"] = string.Empty; // reset to parent value
if (SelectedSlave > 0)
_Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "ID"] = value; // save selected value
else
_Xp["Unit", "ID"] = value; // save selected value
_Xp["Unit", "ID"] = value;
OnPropertyChanged("Unit_ID");
}
}
@ -1026,32 +953,17 @@ namespace VEPROMS.CSLA.Library
get
{
string s = _Xp["Unit", "OtherID"];// get the saved value
//If there is no value to get, then get the parent value (a.k.a. default value).
if (s == string.Empty)
s = _Xp.ParentValue("Unit", "OtherID"); // get the parent value
// If there is no parent value, then use the volian default
if (s == string.Empty)
return s = "";// default to volian default
if (SelectedSlave > 0)
s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "OtherID"];
return s;
}
set
{
// if value being saved is same as the parent value, then clear the value (save blank). This will
// reset the data to use the parent value.
string parval = _Xp.ParentValue("Unit", "OtherID"); // get the parent value
if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default
parval = "";
if (parval.Equals(value))
_Xp["Unit", "OtherID"] = string.Empty; // reset to parent value
if (SelectedSlave > 0)
_Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "OtherID"] = value; // save selected value
else
_Xp["Unit", "OtherID"] = value; // save selected value
OnPropertyChanged("Unit_OtherID");
_Xp["Unit", "OtherID"] = value;
OnPropertyChanged("Other_Unit_ID");
}
}
[Category("Unit")]
@ -1063,34 +975,63 @@ namespace VEPROMS.CSLA.Library
get
{
string s = _Xp["Unit", "ProcedureNumber"];// get the saved value
//If there is no value to get, then get the parent value (a.k.a. default value).
if (s == string.Empty)
s = _Xp.ParentValue("Unit", "ProcedureNumber"); // get the parent value
// If there is no parent value, then use the volian default
if (s == string.Empty)
return s = "";// default to volian default
if (SelectedSlave > 0)
s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "ProcedureNumber"];
return s;
}
set
{
// if value being saved is same as the parent value, then clear the value (save blank). This will
// reset the data to use the parent value.
string parval = _Xp.ParentValue("Unit", "ProcedureNumber"); // get the parent value
if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default
parval = "";
if (parval.Equals(value))
_Xp["Unit", "ProcedureNumber"] = string.Empty; // reset to parent value
if (SelectedSlave > 0)
_Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "ProcedureNumber"] = value; // save selected value
else
_Xp["Unit", "ProcedureNumber"] = value; // save selected value
_Xp["Unit", "ProcedureNumber"] = value;
OnPropertyChanged("Unit_ProcedureNumber");
}
}
[Category("Unit")]
[DisplayName("Unit Specific Procedure Set Name")]
[RefreshProperties(RefreshProperties.All)]
[Description("Assigned Unit Specific Procedure Set Name")]
public string Unit_ProcedureSetName
{
get
{
string s = _Xp["ProcedureSet", "Name"];// get the saved value
if (SelectedSlave > 0)
s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "SetName"];
return s;
}
set
{
if (SelectedSlave > 0)
_Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "SetName"] = value; // save selected value
else
_Xp["ProcedureSet", "Name"] = value;
OnPropertyChanged("Unit_ProcedureSetName");
}
}
[Category("Unit")]
[DisplayName("Unit Specific Procedure Set ID")]
[RefreshProperties(RefreshProperties.All)]
[Description("Assigned Unit Specific Procedure Set ID")]
public string Unit_ProcedureSetID
{
get
{
string s = _Xp["ProcedureSet", "ID"];// get the saved value
if (SelectedSlave > 0)
s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "SetID"];
return s;
}
set
{
if (SelectedSlave > 0)
_Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "SetID"] = value; // save selected value
else
_Xp["ProcedureSet", "ID"] = value;
OnPropertyChanged("Unit_ProcedureSetID");
}
}
#endregion
#region DELETE_ME
/*
@ -1631,5 +1572,29 @@ OnPropertyChanged("Default_BkColor");
}
*/
#endregion
public void AddSlave(string xml)
{
XmlDocument xd = new XmlDocument();
xd.LoadXml(xml);
XmlNode pn = _Xp.XmlContents.SelectSingleNode("//Slaves");
XmlNode nn = _Xp.XmlContents.ImportNode(xd.DocumentElement, true);
pn.AppendChild(nn);
}
public void RemoveSlave(int index)
{
XmlNode dd = _Xp.XmlContents.SelectSingleNode("//Slave[@index='" + index.ToString() + "']");
dd.ParentNode.RemoveChild(dd);
}
public int MaxSlaveIndex
{
get
{
int k = 0;
XmlNodeList nl = _Xp.XmlContents.SelectNodes("//Slave/@index");
foreach (XmlNode n in nl)
k = Math.Max(k, int.Parse(n.InnerText));
return k;
}
}
}
}