private void ControlsToData()
        {
            if (_facilitiesRequirements == null)
                _facilitiesRequirements = new FacilitiesRequirements();

            _facilitiesRequirements.Cooling = edtHydraulic.GetValue<string>();
            _facilitiesRequirements.Hydraulic = edtHydraulic.GetValue<string>();
            _facilitiesRequirements.Pneumatic = edtPneumatic.GetValue<string>();
            _facilitiesRequirements.FacilityRequirementsDocuments = documentListControl1.Documents;

            if (portListControl.Ports == null)
                _facilitiesRequirements.FacilitiesInterface = null;
            else
            {
                if( _facilitiesRequirements.FacilitiesInterface == null )
                    _facilitiesRequirements.FacilitiesInterface = new Interface();
                _facilitiesRequirements.FacilitiesInterface.Ports = portListControl.Ports;
            }

            if (string.IsNullOrEmpty( _facilitiesRequirements.Cooling ) &&
                string.IsNullOrEmpty( _facilitiesRequirements.Hydraulic ) &&
                string.IsNullOrEmpty( _facilitiesRequirements.Pneumatic ) &&
                ( _facilitiesRequirements.FacilitiesInterface == null
                  || _facilitiesRequirements.FacilitiesInterface.Ports == null
                  || _facilitiesRequirements.FacilitiesInterface.Ports.Count == 0 ) &&
                ( _facilitiesRequirements.FacilityRequirementsDocuments == null
                  || _facilitiesRequirements.FacilityRequirementsDocuments.Count == 0 ))
            {
                _facilitiesRequirements = null;
            }
        }
 public static bool LoadFromFile(string fileName, out FacilitiesRequirements obj)
 {
     Exception exception;
     return LoadFromFile(fileName, out obj, out exception);
 }
 public static bool Deserialize(string input, out FacilitiesRequirements obj)
 {
     Exception exception;
     return Deserialize(input, out obj, out exception);
 }
 /// <summary>
 /// Deserializes xml markup from file into an FacilitiesRequirements object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output FacilitiesRequirements object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
 public static bool LoadFromFile(string fileName, out FacilitiesRequirements obj, out Exception exception)
 {
     exception = null;
     obj = default(FacilitiesRequirements);
     try
     {
         obj = LoadFromFile(fileName);
         return true;
     }
     catch (Exception ex)
     {
         exception = ex;
         return false;
     }
 }
 /// <summary>
 /// Deserializes workflow markup into an FacilitiesRequirements object
 /// </summary>
 /// <param name="input">string workflow markup to deserialize</param>
 /// <param name="obj">Output FacilitiesRequirements object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
 public static bool Deserialize(string input, out FacilitiesRequirements obj, out Exception exception)
 {
     exception = null;
     obj = default(FacilitiesRequirements);
     try
     {
         obj = Deserialize(input);
         return true;
     }
     catch (Exception ex)
     {
         exception = ex;
         return false;
     }
 }