private void DataToControls()
{
if (_specification != null)
{
edtSpecDescription.Value = _specification.Description;
edtSpecName.Value = _specification.name;
SpecificationDefinition definition = _specification.Definition;
if (definition != null)
{
rbText.Checked = (definition.Item is String);
rbDocument.Checked = (definition.Item is Document);
if (rbText.Checked)
edtDefinitionText.Value = definition.Item as String;
else if (rbDocument.Checked)
documentControl.Document = definition.Item as Document;
}
//-----------------------------------//
//--- Load the Limit List Control ---//
//-----------------------------------//
if (_specification.Limits != null)
{
limitListControl.Items.Clear();
foreach (Limit limit in _specification.Limits)
{
AddLimitToListView(limit);
}
}
//---------------------------------------//
//--- Load the Condition List Control ---//
//---------------------------------------//
if (_specification.Conditions != null)
{
dgConditions.Rows.Clear();
foreach (String condition in _specification.Conditions)
{
int idx = dgConditions.Rows.Add();
DataGridViewRow row = dgConditions.Rows[idx];
row.Cells["condition"].Value = condition;
}
}
//-----------------------------------------//
//--- Load the Required Options Control ---//
//-----------------------------------------//
if (_specification.RequiredOptions != null)
{
dgRequiredOptions.Rows.Clear();
foreach (String option in _specification.RequiredOptions)
{
int idx = dgRequiredOptions.Rows.Add();
DataGridViewRow row = dgRequiredOptions.Rows[idx];
row.Cells["requiredOption"].Value = option;
}
}
//------------------------------------------//
//--- Load the Exclusive Options Control ---//
//------------------------------------------//
if (_specification.ExclusiveOptions != null)
{
dgExclusiveOptions.Rows.Clear();
foreach (String option in _specification.ExclusiveOptions)
{
int idx = dgExclusiveOptions.Rows.Add();
DataGridViewRow row = dgExclusiveOptions.Rows[idx];
row.Cells["exclusiveOption"].Value = option;
}
}
//-------------------------------------------------//
//--- Load the Supplimental Information Control ---//
//-------------------------------------------------//
if (_specification.SupplementalInformation != null)
{
dgSupplimentalInfo.Rows.Clear();
foreach (String information in _specification.SupplementalInformation)
{
int idx = dgSupplimentalInfo.Rows.Add();
DataGridViewRow row = dgSupplimentalInfo.Rows[idx];
row.Cells["information"].Value = information;
}
}
}
}