ATMLCommonLibrary.controls.specification.SpecificationControl.ControlsToData C# (CSharp) Méthode

ControlsToData() private méthode

private ControlsToData ( ) : void
Résultat void
        private void ControlsToData()
        {
            if (_specification != null)
            {
                _specification.Description = edtSpecDescription.GetValue<string>();
                _specification.name = edtSpecName.GetValue<string>();
                if (limitListControl.Items.Count == 0)
                    _specification.Limits = null;
                else
                {
                    _specification.Limits = new List<Limit>();
                    foreach (ListViewItem item in limitListControl.Items)
                    {
                        _specification.Limits.Add(item.Tag as Limit);
                    }
                }

                _specification.Conditions = new List<string>();
                foreach (DataGridViewRow row in dgConditions.Rows)
                {
                    var value = row.Cells["condition"].Value as String;
                    if (!String.IsNullOrEmpty(value))
                        _specification.Conditions.Add(value);
                }
                if (_specification.Conditions.Count == 0)
                    _specification.Conditions = null;

                _specification.ExclusiveOptions = new List<string>();
                foreach (DataGridViewRow row in dgExclusiveOptions.Rows)
                {
                    var value = row.Cells["exclusiveOption"].Value as String;
                    if (!String.IsNullOrEmpty(value))
                        _specification.ExclusiveOptions.Add(value);
                }
                if (_specification.ExclusiveOptions.Count == 0)
                    _specification.ExclusiveOptions = null;

                _specification.RequiredOptions = new List<string>();
                foreach (DataGridViewRow row in dgRequiredOptions.Rows)
                {
                    var value = row.Cells["requiredOption"].Value as String;
                    if (!String.IsNullOrEmpty(value))
                        _specification.RequiredOptions.Add(value);
                }
                if (_specification.RequiredOptions.Count == 0)
                    _specification.RequiredOptions = null;

                _specification.SupplementalInformation = new List<string>();
                foreach (DataGridViewRow row in dgSupplimentalInfo.Rows)
                {
                    var value = row.Cells["information"].Value as String;
                    if (!String.IsNullOrEmpty(value))
                        _specification.SupplementalInformation.Add(value);
                }
                if (_specification.SupplementalInformation.Count == 0)
                    _specification.SupplementalInformation = null;

                if (rbNone.Checked)
                {
                    _specification.Definition = null;
                }
                else if (rbText.Checked)
                {
                    if (_specification.Definition == null)
                        _specification.Definition = new SpecificationDefinition();
                    _specification.Definition.Item = edtDefinitionText.GetValue<string>();
                }
                else if (rbDocument.Checked)
                {
                    if (_specification.Definition == null)
                        _specification.Definition = new SpecificationDefinition();
                    _specification.Definition.Item = documentControl.Document;
                }

                if (_specification.Definition != null && _specification.Definition.Item == null)
                    _specification.Definition = null;
            }
        }