private void ReadModelValues(PeriodSetting model) { if (model == null) { throw new ArgumentNullException("model"); } YearPart = model.YearPart; StartDate = model.StartDate; EndDate = model.EndDate; SelectedStatus = model.PeriodStatus; _sequenceNo = model.PaymentSequences.Count(); foreach (PaymentSequence seq in model.PaymentSequences) { YearSequences.Add(seq); } if (SelectedStatus != null && SelectedStatus.Id == 1) { ClosedStatus = SelectedStatus.Description; } else { ClosedStatus = null; } RaisePropertyChanged(""); }
/// <summary> /// Start periode. Indien de lopende overeenkomt met de nieuwe match, dan blijft de huidige periode gehandhaafd /// </summary> /// <param name="match"></param> /// <param name="time"></param> public void StartPeriod(bool match, DateTime time) { lastKnownTime = time; switch (status) { case PeriodStatus.inactive: from = time; status = match ? PeriodStatus.activeMatch : PeriodStatus.activeNoMatch; break; case PeriodStatus.activeMatch: if (match) break; //was al match, periodes lopen in elkaar over tot één geheel else //no match { saveNewPeriod(true, time); status = PeriodStatus.activeNoMatch; } break; case PeriodStatus.activeNoMatch: if (match) { saveNewPeriod(false, time); status = PeriodStatus.activeMatch; } else break; //was al no match, periodes lopen in elkaar over tot één geheel break; } }
public Period(string pCode, PeriodStatus period, Year year, DateTime startDate, DateTime end) { CODE = pCode; PERIOD_STATUS = period; YEAR = year; START_DATE = startDate; END_DATA = end; }
/// <summary> /// beeindig huidige periode /// </summary> /// <param name="time"></param> public void End(DateTime time) { switch (status) { case PeriodStatus.inactive: //niets af te sluiten break; case PeriodStatus.activeMatch: //match periode opslaan periods.Add(new MatchPeriod() { From = from, To = lastKnownTime, Match = true }); status = PeriodStatus.inactive; break; case PeriodStatus.activeNoMatch: //match periode opslaan periods.Add(new MatchPeriod() { From = from, To = lastKnownTime, Match = false }); status = PeriodStatus.inactive; break; } }