using MicroFour.StrataFrame.Business;
using System.Collections.Generic;

namespace ReportSS2.ReportBinding
{

    public class RechnungenReportBO : ReportSS2.BuisnessObjects.RechnungenBO
    {

        #region  Private Fields

        private static bool _AreCustomDescriptorsEvaluated = false;
        private static RechpositionenBBS _Rechpositionen = new RechpositionenBBS();

        #endregion

        #region  Protected Methods

        /// <summary>
        /// Determine if the custom descriptors are going to be evaluated
        /// </summary>
        /// <remarks></remarks>
        protected override bool AreCustomDescriptorsEvaluated
        {
            get
            {
                //-- Establish Locals
                bool r = _AreCustomDescriptorsEvaluated;

                //-- Do not eval the desciptors again
                _AreCustomDescriptorsEvaluated = true;

                //-- Return results
                return r;
            }
        }

        /// <summary>
        /// Add additional binding fields
        /// </summary>
        /// <remarks></remarks>
        protected override MicroFour.StrataFrame.Business.FieldPropertyDescriptor[] GetCustomBindablePropertyDescriptors()
        {
            //-- Establish Locals
            List<FieldPropertyDescriptor> r = new List<FieldPropertyDescriptor>();

            //-- Include all of the base descriptors
            try
            {
                r.AddRange(base.GetCustomBindablePropertyDescriptors());
            }
            catch (System.Exception)
            {
            }

            //-- Add the custom descriptors
            //r.Add(New ReflectionPropertyDescriptor("CustomPropertyName", GetType(nameOfThisBO)))
            r.Add(new ReflectionPropertyDescriptor("Rechpositionen", typeof(RechnungenReportBO)));

            //-- Return results
            return r.ToArray();
        }

        #endregion

        #region  Public Properties

        public RechpositionenBBS Rechpositionen
        {
            get
            {
                //-- Filter out the child records that match the current movie record
                if (this.Count > 0)
                {
                    _Rechpositionen.SourceBO.Filter = "RechkopfID = " + this.ID.ToString();
                }

                //-- Return the child items
                return _Rechpositionen;
            }
        }

        #endregion

    }


}