/// <summary>
        /// Init red list information.
        /// </summary>
        /// <param name="taxonSpeciesFact">Taxon species fact view model.</param>
        /// <param name="categorySpeciesFact">Red list category species fact.</param>
        /// <param name="criteriaSpeciesFact">Red list criteria species fact.</param>
        /// <param name="criteriaDocumentationSpeciesFact">Red list criteria documentation species fact.</param>
        /// <param name="globalCategorySpeciesFact">Global red list category species fact.</param>
        /// <param name="period">Red list period.</param>
        public static void InitRedListInformation(
            TaxonSpeciesFactViewModel taxonSpeciesFact,
            ISpeciesFact categorySpeciesFact,
            ISpeciesFact criteriaSpeciesFact,
            ISpeciesFact criteriaDocumentationSpeciesFact,
            ISpeciesFact globalCategorySpeciesFact,
            IPeriod period)
        {
            if (categorySpeciesFact.IsRedlistCategorySpecified())
            {
                taxonSpeciesFact.RedListCategory            = categorySpeciesFact.Field1.EnumValue.OriginalLabel.Substring(0, categorySpeciesFact.Field1.EnumValue.OriginalLabel.Length - 4) + "(" + categorySpeciesFact.MainField.StringValue + ")";
                taxonSpeciesFact.IsRedListed                = categorySpeciesFact.Field1.EnumValue.KeyInt >= (int)RedListCategory.DD && categorySpeciesFact.Field1.EnumValue.KeyInt < (int)RedListCategory.LC;
                taxonSpeciesFact.IsRedListCriteriaAvailable = (categorySpeciesFact.Field1.EnumValue.KeyInt >= (int)RedListCategory.CR) && (categorySpeciesFact.Field1.EnumValue.KeyInt <= (int)RedListCategory.VU);
            }

            if (taxonSpeciesFact.IsRedListCriteriaAvailable && criteriaSpeciesFact.IsRedlistCriteriaSpecified())
            {
                taxonSpeciesFact.RedListCriteria = criteriaSpeciesFact.MainField.StringValue;
            }

            if (globalCategorySpeciesFact.IsGlobalRedlistCategorySpecified())
            {
                taxonSpeciesFact.GlobalRedListCategory = globalCategorySpeciesFact.MainField.StringValue;
            }

            if (criteriaDocumentationSpeciesFact.IsRedlistDocumentationSpecified())
            {
                taxonSpeciesFact.RedListDocumentationQuality = criteriaDocumentationSpeciesFact.Quality.Id;
                taxonSpeciesFact.RedListDocumentationText    = criteriaDocumentationSpeciesFact.MainField.StringValue;
            }

            taxonSpeciesFact.Period = period.Year;
        }
 /// <summary>
 /// Expands a Species Fact List with empty species facts so that every combination from the user parameter selection is represented.
 /// Factor Headers are excluded.
 /// Periodic factors are not expanded to individual categories other than the default.
 /// </summary>
 /// <param name="userContext">The user context.</param>
 /// <param name="taxon">Taxon object of the species fact.</param>
 /// <param name="individualCategory">Individual category object of the species fact.</param>
 /// <param name="factor">Factor object of the species fact.</param>
 /// <param name="host">Host taxon object of the species fact.</param>
 /// <param name="period">Period object of the species fact.</param>
 /// <param name="speciesFacts">Species fact list to be expanded.</param>
 private static void ExpandSpeciesFactListWithEmptySpeciesFact(
     IUserContext userContext,
     ITaxon taxon,
     IIndividualCategory individualCategory,
     IFactor factor,
     ITaxon host,
     IPeriod period,
     SpeciesFactList speciesFacts)
 {
     if (!speciesFacts.Exists(CoreData.SpeciesFactManager.GetSpeciesFactIdentifier(
                                  taxon,
                                  individualCategory,
                                  factor,
                                  host,
                                  period)))
     {
         speciesFacts.Add(CoreData.SpeciesFactManager.GetSpeciesFact(
                              userContext,
                              taxon,
                              individualCategory,
                              factor,
                              host,
                              period));
     }
 }
        public override HashSet <IPeriod> Evaluate(IDateTime referenceDate, DateTime periodStart, DateTime periodEnd, bool includeReferenceDateInResults)
        {
            // Create a recurrence pattern suitable for use during evaluation.
            IRecurrencePattern pattern = ProcessRecurrencePattern(referenceDate);

            // Enforce evaluation restrictions on the pattern.
            EnforceEvaluationRestrictions(pattern);

            HashSet <IPeriod> periods = new HashSet <IPeriod>();

            foreach (DateTime dt in GetDates(referenceDate, periodStart, periodEnd, -1, pattern, includeReferenceDateInResults))
            {
                // Create a period from the date/time.
                IPeriod p = CreatePeriod(dt, referenceDate);

                if (!periods.Contains(p))
                {
                    periods.Add(p);
                }
            }


            Periods.Clear();

            Periods.UnionWith(periods);

            return(Periods);
        }
示例#4
0
 public int CompareTo(IPeriod period)
 {
     if (ID == period.ID)
     {
         return(0);
     }
     if (!MinPeriod.HasValue && period == null)
     {
         return(0);
     }
     if (!MinPeriod.HasValue)
     {
         // Вместо 0 должно быть -1, но я не ебу, почему с -1 не работает, поэтому 0;
         return(0);
     }
     if (period == null)
     {
         return(1);
     }
     if (MinPeriod.Value < period.MinPeriod)
     {
         return(-1);
     }
     if (MinPeriod.Value > period.MinPeriod)
     {
         return(1);
     }
     return(0);
 }
示例#5
0
 public override bool Equals(object obj)
 {
     if (obj is IPeriod)
     {
         IPeriod p = (IPeriod)obj;
         if (MatchesDateOnly || p.MatchesDateOnly)
         {
             return
                 (StartTime.Value.Date == p.StartTime.Value.Date &&
                  (
                      EndTime == null ||
                      p.EndTime == null ||
                      EndTime.Value.Date.Equals(p.EndTime.Value.Date)
                  ));
         }
         else
         {
             return
                 (StartTime.Equals(p.StartTime) &&
                  (
                      EndTime == null ||
                      p.EndTime == null ||
                      EndTime.Equals(p.EndTime)
                  ));
         }
     }
     return(false);
 }
示例#6
0
 public FreeBusyEntry(IPeriod period, FreeBusyStatus status)
 {
     //Sets the status associated with a given period, which requires copying the period values
     //Probably the Period object should just have a FreeBusyStatus directly?
     CopyFrom(period);
     Status = status;
 }
示例#7
0
        public override IList <IPeriod> Evaluate(IDateTime referenceDate, DateTime periodStart, DateTime periodEnd, bool includeReferenceDateInResults)
        {
            // TODO items can only recur if a start date is specified
            if (Todo.Start != null)
            {
                base.Evaluate(referenceDate, periodStart, periodEnd, includeReferenceDateInResults);

                // Ensure each period has a duration
                for (int i = 0; i < Periods.Count; i++)
                {
                    IPeriod p = Periods[i];
                    if (p.EndTime == null)
                    {
                        p.Duration = Todo.Duration;
                        if (p.Duration != null)
                        {
                            p.EndTime = p.StartTime.Add(Todo.Duration);
                        }
                        else
                        {
                            p.EndTime = p.StartTime;
                        }
                    }
                }

                return(Periods);
            }
            return(new List <IPeriod>());
        }
示例#8
0
        public static string ConvertTo(IPeriod value)
        {
            if (value == null)
            {
                return(null);
            }

            var yearPeriod = value as YearPeriod;

            if (yearPeriod != null)
            {
                return(yearPeriod.Year.ToString());
            }

            var dayPeriod = value as DayPeriod;

            if (dayPeriod != null)
            {
                return(string.Format("{0}-{1}-{2}",
                                     dayPeriod.Day.Year,
                                     (dayPeriod.Day.Month < 10 ? "0" : string.Empty) + dayPeriod.Day.Month,
                                     (dayPeriod.Day.Day < 10 ? "0" : string.Empty) + dayPeriod.Day.Day));
            }

            throw new NotSupportedException("Cannot convert type: " + value.GetType());
        }
示例#9
0
        /// <summary>
        ///     Determines whether the specified <see cref="System.Object" /> is equal to this instance.
        /// </summary>
        /// <param name="obj">
        ///     The <see cref="System.Object" /> to compare with this instance.
        /// </param>
        /// <returns>
        ///     <c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>
        public override bool Equals(object obj)
        {
            var period = obj as IPeriod;

            if (period != null)
            {
                IPeriod p = period;
                if (MatchesDateOnly || p.MatchesDateOnly)
                {
                    return
                        (StartTime.Value.Date == p.StartTime.Value.Date &&
                         (
                             EndTime == null ||
                             p.EndTime == null ||
                             EndTime.Value.Date.Equals(p.EndTime.Value.Date)
                         ));
                }

                return
                    (StartTime.Equals(p.StartTime) &&
                     (
                         EndTime == null ||
                         p.EndTime == null ||
                         EndTime.Equals(p.EndTime)
                     ));
            }
            return(false);
        }
示例#10
0
        public static AbstractFigure CreateFigure(Stock stock, Type figureType, IPeriod period, Currency currency)
        {
            var figure = ( AbstractFigure )Activator.CreateInstance(figureType);

            figure.Period = period;

            var currencyFigure = figure as AbstractCurrencyFigure;

            if (currencyFigure != null)
            {
                currencyFigure.Currency = currency;
            }

            var foreignKey = figureType.GetProperty("Stock");

            if (foreignKey != null)
            {
                foreignKey.SetValue(figure, stock);
            }
            else
            {
                foreignKey = figureType.GetProperty("Company");

                Contract.Invariant(foreignKey != null, "ForeignKey detection failed");

                foreignKey.SetValue(figure, stock.Company);
            }

            return(figure);
        }
示例#11
0
 public int CompareTo(IPeriod other)
 {
     if (other is null)
     {
         throw new ArgumentNullException();
     }
     else if (this.GetType() != other.GetType())
     {
         throw new ArgumentException($"Compare to {other.GetType()} is not supported.");
     }
     else
     {
         var fqp = (FiscalQuarterPeriod)other;
         if (year != fqp.year)
         {
             return(year < fqp.year ? -1 : 1);
         }
         else if (quarter != fqp.quarter)
         {
             return(quarter < fqp.quarter ? -1 : 1);
         }
         else
         {
             return(0);
         }
     }
 }
示例#12
0
        /// <summary>
        /// Evaluates this event to determine the dates and times for which the event occurs.
        /// This method only evaluates events which occur between <paramref name="FromDate"/>
        /// and <paramref name="ToDate"/>; therefore, if you require a list of events which
        /// occur outside of this range, you must specify a <paramref name="FromDate"/> and
        /// <paramref name="ToDate"/> which encapsulate the date(s) of interest.
        /// <note type="caution">
        ///     For events with very complex recurrence rules, this method may be a bottleneck
        ///     during processing time, especially when this method in called for a large number
        ///     of events, in sequence, or for a very large time span.
        /// </note>
        /// </summary>
        /// <param name="FromDate">The beginning date of the range to evaluate.</param>
        /// <param name="ToDate">The end date of the range to evaluate.</param>
        /// <returns></returns>
        public override IList <IPeriod> Evaluate(IDateTime referenceTime, DateTime periodStart, DateTime periodEnd, bool includeReferenceDateInResults)
        {
            // Evaluate recurrences normally
            base.Evaluate(referenceTime, periodStart, periodEnd, includeReferenceDateInResults);

            // Ensure each period has a duration
            for (int i = 0; i < Periods.Count; i++)
            {
                IPeriod p = Periods[i];
                if (p.EndTime == null)
                {
                    p.Duration = Event.Duration;
                    if (p.Duration != null)
                    {
                        p.EndTime = p.StartTime.Add(Event.Duration);
                    }
                    else
                    {
                        p.EndTime = p.StartTime;
                    }
                }
            }

            return(Periods);
        }
示例#13
0
        public void setFollower(IPeriod follower)
        {
            e_sideType follSide = __hlp.getSideType(_link, e_linkObject.follower);

            if (follSide == e_sideType._Finish) d_follower_handler = follower.setFinish;
            else d_follower_handler = follower.setStart;
        }
示例#14
0
        public static byte GetPeriodNumber(this IPeriod period)
        {
            switch (period)
            {
            case I1Period _:
                return(1);

            case I2Period _:
                return(2);

            case I3Period _:
                return(3);

            case I4Period _:
                return(4);

            case I5Period _:
                return(5);

            case I6Period _:
                return(6);

            case I7Period _:
                return(7);

            default:
                return(0);
            }
        }
        /// <summary>
        /// Price collection event: When a period in the collection is changed
        /// </summary>
        /// <param name="collection">The period collection</param>
        /// <param name="index">The index of element of the collection</param>
        void IPeriodCollection_Updated(IPeriodCollection collection, int index)
        {
            IPeriod period = collection[index];

            Console.WriteLine("Price updated: DateTime={0}, BidOpen={1}, BidHigh={2}, BidLow={3}, BidClose={4}, AskOpen={5}, AskHigh={6}, AskLow={7}, AskClose={8}, Volume={9}",
                              period.Time, period.Bid.Open, period.Bid.High, period.Bid.Low, period.Bid.Close,
                              period.Ask.Open, period.Ask.High, period.Ask.Low, period.Ask.Close, period.Volume);
        }
示例#16
0
 public void SavePeriod(IPeriod period)
 {
     if (!this._periodeDb.ContainsKey(period.PeriodId))
     {
         this._periodeDb.Add(period.PeriodId, period);
     }
     this._periodeDb[period.PeriodId] = period;
 }
示例#17
0
 public void setPrecursor(IPeriod precursor)
 {
     if (_parent != null)
     {
         unlink();
     }
     _parent = precursor;
 }
示例#18
0
 public virtual bool CollidesWith(IPeriod period)
 {
     if (period != null && ((period.StartTime != null && Contains(period.StartTime)) || (period.EndTime != null && Contains(period.EndTime))))
     {
         return true;
     }
     return false;
 }
 private IEnumerable <Date> GenerateForSinglePeriod(IPeriod period)
 {
     return(_weeksSelector
            .Match(
                some: weeksSelector => weeksSelector.Pick(period.Weeks()),
                none: () => (IEnumerable <IPeriod>) new[] { period })
            .SelectMany(p => _timeSelector.Filter(p)));
 }
示例#20
0
        /// <summary>
        /// Sets the period in time.
        /// </summary>
        /// <param name="period">The period in time.</param>
        /// <exception cref="ArgumentException">The start datetime is after or equal to end datetime.</exception>
        public void SetPeriod(IPeriod period)
        {
            Guard.NotNull(period);

            StartDate = period.StartDate;
            EndDate   = period.EndDate;

            Duration = EndDate - StartDate;
        }
        private IEnumerable <Date> GenerateForSinglePeriod(IPeriod period)
        {
            var selectedPeriods = _monthsSelector.Match(
                some: monthSelector => monthSelector.Pick(period.Months()),
                none: () => (IEnumerable <IPeriod>) new[] { period });

            return(_weeklySelections
                   .SelectMany(weeklySelection => weeklySelection.Generate(selectedPeriods)));
        }
        public IEnumerable <Date> GenerateForSinglePeriod(IPeriod period)
        {
            var selectedPeriods = _yearsSelector.Match(
                some: yearSelector => yearSelector.Pick(period.Years()),
                none: () => (IEnumerable <IPeriod>) new[] { period });

            return(_monthlySelections
                   .SelectMany(monthlySelection => monthlySelection.Generate(selectedPeriods)));
        }
示例#23
0
 protected BasePeriod(IPeriod period)
 {
     if (period == null)
     {
         throw new ArgumentNullException("Period is null");
     }
     Start = period.Start;
     End   = period.End;
 }
 /// <summary>
 /// Creates a species fact instance with no data from web service.
 /// </summary>
 /// <param name="userContext">
 /// Information about the user that makes this method call.
 /// </param>
 /// <param name="taxon">Taxon object of the species fact</param>
 /// <param name="individualCategory">Individual category object of the species fact</param>
 /// <param name="factor">Factor object of the species fact</param>
 /// <param name="host">Host taxon object of the species fact</param>
 /// <param name="period">Period object of the species fact</param>
 public SpeciesFactRedListCriteriaDocumentation(IUserContext userContext,
                                                ITaxon taxon,
                                                IIndividualCategory individualCategory,
                                                IFactor factor,
                                                ITaxon host,
                                                IPeriod period)
     : base(userContext, taxon, individualCategory, factor, host, period)
 {
 }
        /// <summary>
        /// Remove period from current species fact data set scope.
        /// The species facts in the data set are updated
        /// to the new species fact data set scope.
        /// </summary>
        /// <param name="userContext">
        /// Information about the user that makes this method call.
        /// </param>
        /// <param name="selection">Changed scope of the data set.</param>
        public virtual void RemoveSelection(IUserContext userContext,
                                            IPeriod selection)
        {
            ISpeciesFactDataSetSelection newSelection;

            newSelection = new SpeciesFactDataSetSelection();
            newSelection.Periods.Merge(selection);
            RemoveSelection(userContext, newSelection);
        }
        /// <summary>
        /// Add period to search criteria.
        /// </summary>
        /// <param name="period">The period.</param>
        public void Add(IPeriod period)
        {
            if (Periods.IsNull())
            {
                Periods = new PeriodList();
            }

            Periods.Add(period);
        }
示例#27
0
 public ScoreController(IMatrix mx, IClass cls, IStudent stu, IPeriod pr, IScore sr, ICourse crs)
 {
     this.mx  = mx;
     this.cls = cls;
     this.stu = stu;
     this.pr  = pr;
     this.crs = crs;
     this.sr  = sr;
 }
 /// <summary>
 /// Creates a species fact instance with no data from web service.
 /// </summary>
 /// <param name="userContext">
 /// Information about the user that makes this method call.
 /// </param>
 /// <param name="taxon">Taxon object of the species fact</param>
 /// <param name="individualCategory">Individual category object of the species fact</param>
 /// <param name="factor">Factor object of the species fact</param>
 /// <param name="host">Host taxon object of the species fact</param>
 /// <param name="period">Period object of the species fact</param>
 public SpeciesFactRedListCategory(IUserContext userContext,
                                   ITaxon taxon,
                                   IIndividualCategory individualCategory,
                                   IFactor factor,
                                   ITaxon host,
                                   IPeriod period)
     : base(userContext, taxon, individualCategory, factor, host, period)
 {
     _redListCategoryAutomaticFactor = CoreData.FactorManager.GetFactor(userContext, FactorId.RedListCategoryAutomatic);
 }
示例#29
0
 protected virtual void linkDates(IPeriod precursor, IPeriod follower, e_linkType lType)
 {
     if (enabled != true) return;
     _parent = precursor;
     _child = follower;
     _type = lType;
     //_sideChild = __hlp.getSideType(lType, e_linkObject.follower);
     //_sideParent = __hlp.getSideType(lType, e_linkObject.precursor);
     linkDates();
 }
示例#30
0
        public IQueryable <Purchase> SelectPurchasesByPeriod(IPeriod period_)
        {
            var res = (from p in Purchase
                       where
                       (p.Date.Month == period_.MonthYear.Month) &&
                       (p.Date.Year == period_.MonthYear.Year)
                       select p);

            return(res);
        }
示例#31
0
        public int CompareTo(IPeriod other)
        {
            var otherDay = other as DayPeriod;

            if (otherDay == null)
            {
                return(-2);
            }

            return(Day.CompareTo(otherDay.Day));
        }
示例#32
0
        public bool Equals(IPeriod other)
        {
            var otherDay = other as DayPeriod;

            if (otherDay == null)
            {
                return(false);
            }

            return(Day == otherDay.Day);
        }
示例#33
0
 public abstract bool setParent(IPeriod oParent);
示例#34
0
 public abstract bool setChild(IPeriod oChild);
示例#35
0
        protected virtual void resetLink()
        {
            _parent.event_finishChanged -= _handler_precursorDateChanged;
            _parent.event_startChanged -= _handler_precursorDateChanged;

            _child.event_finishChanged -= _handler_followerDateChanged;
            _child.event_startChanged -= _handler_followerDateChanged;

            _child = null;
            _parent = null;

            _type = e_linkType.none;
            _sideChild = (int)0;
            _sideParent = (int)0;

            datePrecursor = null;
            dateFollower = null;
        }
示例#36
0
 public void Insert(int index, IPeriod item)
 {
     m_Periods.Insert(index, item);
 }
 public TimeZoneObservance(IPeriod period, ITimeZoneInfo tzi) : this()
 {
     Period = period;
     TimeZoneInfo = tzi;
 }
 public IList<Dto.SummaryAkunDto> ListSummaryAkunIn(IPeriod period, string[] listAkun)
 {
     throw new NotImplementedException();
 }
示例#39
0
        /// <summary>
        /// Sets the period in time.
        /// </summary>
        /// <param name="period">The period in time.</param>
        /// <exception cref="ArgumentException">The start datetime is after or equal to end datetime.</exception>
        public void SetPeriod(IPeriod period)
        {
            Guard.NotNull(period);

            StartDate = period.StartDate;
            EndDate = period.EndDate;

            Duration = EndDate - StartDate;
        }
示例#40
0
 public int IndexOf(IPeriod item)
 {
     return m_Periods.IndexOf(item);
 }
示例#41
0
 public void CopyTo(IPeriod[] array, int arrayIndex)
 {
     m_Periods.CopyTo(array, arrayIndex);
 }
示例#42
0
文件: Period.cs 项目: alexed1/dtrack
 virtual public bool CollidesWith(IPeriod period)
 {
     if (period != null &&
         (
             (period.StartTime != null && Contains(period.StartTime)) ||
             (period.EndTime != null && Contains(period.EndTime))
         ))
     {
         return true;
     }
     return false;
 }
示例#43
0
 public bool Contains(IPeriod item)
 {
     return m_Periods.Contains(item);
 }
示例#44
0
 virtual public void Add(IPeriod item)
 {
     m_Periods.Add(item);
 }
示例#45
0
 /// <summary>
 /// Determines whether the first period contains the second.
 /// </summary>
 /// <param name="period">The period.</param>
 /// <returns>
 ///     <c>true</c> if the first period contains the second; otherwise, <c>false</c>.
 /// </returns>
 public Boolean Contains(IPeriod period)
 {
     return Contains(this, period);
 }
示例#46
0
 /// <summary>
 /// Determines whether the first period contains the second.
 /// </summary>
 /// <param name="firstPeriod">The first period.</param>
 /// <param name="secondPeriod">The second period.</param>
 /// <returns>
 ///     <c>true</c> if the first period contains the second; otherwise, <c>false</c>.
 /// </returns>
 public static Boolean Contains(IPeriod firstPeriod, IPeriod secondPeriod)
 {
     return firstPeriod != null && secondPeriod != null &&
            secondPeriod.StartDate >= firstPeriod.StartDate && secondPeriod.EndDate <= firstPeriod.EndDate;
 }
示例#47
0
 public void setPrecursor(IPeriod precursor)
 {
     if (_parent != null) unlink();
     _parent = precursor;
 }
示例#48
0
 public bool Remove(IPeriod item)
 {
     return m_Periods.Remove(item);
 }
示例#49
0
 /// <summary>
 /// Determines whether the specified periods overlap.
 /// </summary>
 /// <param name="period">The period.</param>
 /// <returns>
 ///     <c>true</c> if the specified periods overlap; otherwise, <c>false</c>.
 /// </returns>
 public Boolean HasOverlap(IPeriod period)
 {
     return HasOverlap(this, period);
 }
示例#50
0
文件: Period.cs 项目: alexed1/dtrack
 public int CompareTo(IPeriod p)
 {
     if (p == null)
         throw new ArgumentNullException("p");
     else if (Equals(p))
         return 0;
     else if (StartTime.LessThan(p.StartTime))
         return -1;
     else if (StartTime.GreaterThanOrEqual(p.StartTime))
         return 1;
     throw new Exception("An error occurred while comparing Period values.");
 }
示例#51
0
 /// <summary>
 /// Determines whether the specified periods overlap.
 /// </summary>
 /// <param name="firstPeriod">The first period.</param>
 /// <param name="secondPeriod">The second period.</param>
 /// <returns>
 ///     <c>true</c> if the specified periods overlap; otherwise, <c>false</c>.
 /// </returns>
 public static Boolean HasOverlap(IPeriod firstPeriod, IPeriod secondPeriod)
 {
     return firstPeriod != null && secondPeriod != null &&
            secondPeriod.StartDate < firstPeriod.EndDate && secondPeriod.EndDate > firstPeriod.StartDate;
 }
示例#52
0
 public FreeBusyEntry(IPeriod period, FreeBusyStatus status) : base()
 {
     Initialize();
     CopyFrom(period);
     Status = status;
 }
 public void SavePeriod(IPeriod period)
 {
     if (!this._periodeDb.ContainsKey(period.PeriodId))
         this._periodeDb.Add(period.PeriodId, period);
     this._periodeDb[period.PeriodId] = period;
 }
示例#54
0
 virtual public FreeBusyStatus GetFreeBusyStatus(IPeriod period)
 {
     FreeBusyStatus status = FreeBusyStatus.Free;
     if (period != null)
     {                
         foreach (IFreeBusyEntry fbe in Entries)
         {
             if (fbe.CollidesWith(period) && status < fbe.Status)
                 status = fbe.Status;
         }
     }
     return status;
 }
示例#55
0
        // clone the DDay.iCal event, update dtstart (and maybe dtend) with Year/Month/Day for this occurrence
        public static DDay.iCal.Event PeriodizeRecurringEvent(DDay.iCal.Event evt, IPeriod period)
        {
            var kind = evt.Start.IsUniversalTime ? DateTimeKind.Utc : DateTimeKind.Local;

            var dtstart = new DateTime(
                period.StartTime.Year,
                period.StartTime.Month,
                period.StartTime.Day,
                evt.Start.Hour,
                evt.Start.Minute,
                evt.Start.Second,
                kind);

            var idtstart = new iCalDateTime(dtstart);

            var idtend = default(iCalDateTime);
            DateTime dtend = default(DateTime);

            if (evt.DTEnd != null && evt.DTEnd.Year != 1 )
            {
                dtend = new DateTime(
                    period.EndTime.Year,
                    period.EndTime.Month,
                    period.EndTime.Day,
                    evt.End.Hour,
                    evt.End.Minute,
                    evt.End.Second,
                    kind);

                idtend = new iCalDateTime(dtend);
            }

            var instance = new DDay.iCal.Event();
            instance.Start = idtstart;
            instance.End = idtend;
            instance.Summary = evt.Summary;
            instance.Description = evt.Description;
            foreach (var cat in evt.Categories)
                instance.Categories.Add(cat);
            instance.Location = evt.Location;
            instance.GeographicLocation = evt.GeographicLocation;
            instance.UID = evt.UID;
            instance.Url = evt.Url;
            return instance;
        }