using System;

using BS.Shared.Core;

namespace BS.Shared.DataContracts
{
    public partial class AbsenceTimeDC
    {
        public DateTimeSpan AbsenceSpan
        {
            get
            {
                if (this.Start.HasValue)
                {
                    DateTimeSpan span = new DateTimeSpan();
                    span.StartDateTime = this.Start.Value;

                    if (this.End.HasValue)
                    {
                        span.EndDateTime = this.End.Value;
                    }
                    else
                    {
                        span.EndDateTime = DateTime.MaxValue;
                    }

                    return span;
                }

                return null;
            }
        }
    }
}