/// ------------------------------------------------------------------------------------------------
 /// Name        Refresh
 ///
 /// <summary>   Refreshes the properties from the first record in the record groups collection.
 /// </summary>
 /// <remarks>
 /// </remarks>
 /// ------------------------------------------------------------------------------------------------
 ///
 public void Refresh()
 {
     foreach (SRiRequestGroup rg in RequestGroups)
     {
         foreach (SRiRecordMeta record in rg.Records)
         {
             Address   = new OnSiteAddress(record.Record.Address);
             Latitude  = record.Record.Latitude;
             Longitude = record.Record.Longitude;
             TradeName = record.Record.TradeName;
             UPRN      = record.Record.UPRN;
             return;
         }
     }
 }
        ///
        #endregion
        /// ------------------------------------------------------------------------------------------------
        #region Private Functions and Methods
        /// ------------------------------------------------------------------------------------------------
        ///
        /// ------------------------------------------------------------------------------------------------
        /// Name        Match
        ///
        /// <summary>   Compares 2 OnSiteAddress properties.
        /// </summary>
        /// <param name="a">        OnSiteAddress a.</param>
        /// <param name="b">        OnSiteAddress b.</param>
        ///
        /// <returns>   True if match.
        /// </returns>
        /// <remarks>
        /// </remarks>
        /// ------------------------------------------------------------------------------------------------
        ///
        private bool Match(OnSiteAddress a, OnSiteAddress b)
        {
            bool match;

            //
            if (a == null || b == null)
            {
                match = false;
            }
            else
            {
                match = Match(a.LongAddress, b.LongAddress);
            }
            //
            return(match);
        }
 /// ------------------------------------------------------------------------------------------------
 #region Public Constructors
 /// ------------------------------------------------------------------------------------------------
 ///
 /// ------------------------------------------------------------------------------------------------
 /// Name		SRiProperty
 ///
 /// <summary>	Creates a new instance of the SRIProperty class.
 /// </summary>
 /// <param name="record">		The first record in the record collection.</param>
 ///
 /// <remarks>
 /// </remarks>
 /// ------------------------------------------------------------------------------------------------
 ///
 public SRiProperty(SRiRecordMeta record)
 {
     RequestGroups   = new List <SRiRequestGroup>();
     Documents       = new List <OnSiteDocumentData>();
     PropertyDetails = new List <SRiPropertyDetail>();
     CPInfos         = new List <SRiCPInfoMeta>();
     LICases         = new List <SRiLICaseMeta>();
     //
     Address   = new OnSiteAddress(record.Record.Address);
     Latitude  = record.Record.Latitude;
     Longitude = record.Record.Longitude;
     TradeName = record.Record.TradeName;
     UPRN      = record.Record.UPRN;
     //Added by Gowtham for getting organisation name in the Property field. It has not been in the code given by louis.
     Organisation = record.Organisation;
     RequestGroups.Add(new SRiRequestGroup(record));
 }
        ///
        /// ------------------------------------------------------------------------------------------------
        /// Name		AddRecord
        ///
        /// <summary>	Adds a record to the request group collection. Putting it in either an existing
        ///             group that has a matching request type or creating a new group.
        /// </summary>
        /// <param name="record">		The record to add.</param>
        ///
        /// <remarks>
        /// </remarks>
        /// ------------------------------------------------------------------------------------------------
        ///
        public void AddRecord(SRiRecordMeta record)
        {
            bool addedToGroup;

            //
            addedToGroup = false;
            foreach (var rg in RequestGroups)
            {
                if (rg.GroupType.Equals(record.Record.RequestType))
                {
                    rg.Records.Add(record);
                    addedToGroup = true;
                    break;
                }
            }
            //
            if (!addedToGroup)
            {
                RequestGroups.Add(new SRiRequestGroup(record));
            }
            //
            // If any of the record fields in the property are missing,
            // take the field from the new record.
            if (string.IsNullOrEmpty(UPRN))
            {
                UPRN = record.Record.UPRN;
            }
            if (string.IsNullOrEmpty(TradeName))
            {
                TradeName = record.Record.TradeName;
            }
            if (string.IsNullOrEmpty(Address.RawAddress))
            {
                Address = new OnSiteAddress(record.Record.Address);
            }
            if (!HasValidCoords)
            {
                Latitude  = record.Record.Latitude;
                Longitude = record.Record.Longitude;
            }
            //Added by Gowtham for getting organisation name in the new property. It has not been in the code given by louis.
            Organisation = record.Organisation;
        }