/// <summary> /// Evalates the ExDate component, and excludes each specified DateTime or /// Period from the <see cref="Periods"/> collection. /// </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> virtual protected void EvaluateExDate(iCalDateTime FromDate, iCalDateTime ToDate) { // Handle EXDATEs if (ExDate != null) { foreach (RecurrenceDates exdate in ExDate) { List <Period> periods = exdate.Evaluate(DTStart, FromDate, ToDate); foreach (Period p in periods) { // If no time was provided for the ExDate, then it excludes the entire day if (!p.StartTime.HasTime || (p.EndTime != null && !p.EndTime.HasTime)) { p.MatchesDateOnly = true; } if (p != null) { while (Periods.Contains(p)) { Periods.Remove(p); } } } } } }
/// <summary> /// Evalates the ExDate component, and excludes each specified DateTime or /// Period from the <see cref="Periods"/> collection. /// </summary> /// <param name="periodStart">The beginning date of the range to evaluate.</param> /// <param name="periodEnd">The end date of the range to evaluate.</param> virtual protected void EvaluateExDate(IDateTime referenceDate, DateTime periodStart, DateTime periodEnd) { // Handle EXDATEs if (Recurrable.ExceptionDates != null) { foreach (IPeriodList exdate in Recurrable.ExceptionDates) { IEvaluator evaluator = exdate.GetService(typeof(IEvaluator)) as IEvaluator; if (evaluator != null) { IList <IPeriod> periods = evaluator.Evaluate(referenceDate, periodStart, periodEnd, false); foreach (IPeriod p in periods) { // If no time was provided for the ExDate, then it excludes the entire day if (!p.StartTime.HasTime || (p.EndTime != null && !p.EndTime.HasTime)) { p.MatchesDateOnly = true; } while (Periods.Contains(p)) { Periods.Remove(p); } } } } } }
public void DeletePeriod(int periodId) { var period = GetPeriod(periodId); if (period != null) { Periods.Remove(period); } }
private void RemovePeriodCmd() { var Yes = MessageBox.Show("Would you like delete project?\n All Tasks and Periods will be deleted!!!", "Deleting Project", MessageBoxButton.YesNo); if (Yes == MessageBoxResult.Yes) { MainContext.Remove(SelectedPeriod); Periods.Remove(SelectedPeriod); MainContext.SaveChanges(); } }
/// <summary> /// Evaluates the ExRule component, and excludes each specified DateTime /// from the <see cref="Evaluator.Periods" /> collection. /// </summary> /// <param name="referenceDate">The reference date.</param> /// <param name="periodStart">The period start.</param> /// <param name="periodEnd">The period end.</param> protected virtual void EvaluateExRule(IDateTime referenceDate, DateTime periodStart, DateTime periodEnd) { // Handle EXRULEs if (Recurrable.ExceptionRules != null) { foreach (IRecurrencePattern exrule in Recurrable.ExceptionRules) { var evaluator = exrule.GetService(typeof(IEvaluator)) as IEvaluator; if (evaluator != null) { ISet <IPeriod> periods = evaluator.Evaluate(referenceDate, periodStart, periodEnd, false); foreach (IPeriod p in periods) { Periods.Remove(p); } } } } }
/// <summary> /// Evalates the ExDate component, and excludes each specified DateTime or /// Period from the <see cref="Periods"/> collection. /// </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> protected override void EvaluateExDate(Date_Time FromDate, Date_Time ToDate) { // Handle EXDATEs if (ExDate != null) { foreach (RDate exdate in ExDate) { ArrayList Items = exdate.Evaluate(DTStart, FromDate, ToDate); foreach (object obj in Items) { Period p = null; if (obj is Period) { p = (Period)obj; } else if (obj is Date_Time) { p = new Period((Date_Time)obj, Duration); } // If no time was provided for the ExDate, then it excludes the entire day if (!p.StartTime.HasTime || !p.EndTime.HasTime) { p.MatchesDateOnly = true; } if (p != null) { // If p.MatchesDateOnly, remove all occurrences of this event // on that specific date while (Periods.Contains(p)) { Periods.Remove(p); DateTimes.Remove(p.StartTime); } } } } } }
/// <summary> /// Evalates the ExDate component, and excludes each specified DateTime or /// Period from the <see cref="Periods"/> collection. /// </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> virtual protected void EvaluateExDate(Date_Time FromDate, Date_Time ToDate) { // Handle EXDATEs if (ExDate != null) { foreach (RDate exdate in ExDate) { ArrayList Items = exdate.Evaluate(DTStart, FromDate, ToDate); foreach (object obj in Items) { Period p = null; if (obj is Period) { p = (Period)obj; } else if (obj is Date_Time) { p = new Period((Date_Time)obj); } // If no time was provided for the ExDate, then it excludes the entire day if (!p.StartTime.HasTime || (p.EndTime != null && !p.EndTime.HasTime)) { p.MatchesDateOnly = true; } if (p != null) { while (Periods.Contains(p)) { Periods.Remove(p); } } } } } }