private void timeSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e) { switch ((int)e.NewValue) { case 10: End = Start.AddMinutes(1); break; case 9: End = Start.AddMinutes(5); break; case 8: End = Start.AddMinutes(10); break; case 7: End = Start.AddMinutes(30); break; case 6: End = Start.AddHours(1); break; case 5: End = Start.AddHours(2); break; case 4: End = Start.AddHours(4); break; case 3: End = Start.AddHours(12); break; case 2: End = Start.AddHours(24); break; case 1: End = Start.AddHours(48); break; case 0: End = Start.AddHours(64); break; } }
public Event() { if (End == null) { this.End = Start.AddMinutes(5); } }
public EventDto(ActivityDto activity) { Id = activity.Id; Start = DateTime.Parse(activity.Schedule, new System.Globalization.CultureInfo("es-AR")); activity.Duration = activity.Duration > 0 ? activity.Duration : 60; End = Start.AddMinutes(activity.Duration); Title = activity.TipoActividad.Name; level = activity.Level.Name; LevelCode = activity.Level.Code; membership = activity.MembershipType.Name; pendings = activity.PendingEnrollment; AllowEnrollment = false; BackgroundColor = "#FF0000"; ActivityId = activity.Id; DateTime ArgentinaTime = getArgentinaTime(); if ( (activity.PendingEnrollment > 0) && (activity.EstadoActividadId.Equals(EstadoActividad.Abierta)) && ((Start - ArgentinaTime).TotalHours >= 0) ) { AllowEnrollment = true; BackgroundColor = "#2196f3"; } status = activity.EstadoActividad.Name; }
public override void Validate() { if (End != Start.AddMinutes(Movie.Length)) { throw new BusinessException(ErrorCodes.BadRequest, "O horário de fim deve ser igual ao início + duração do filme."); } }
public Question(Guid ownerId, Guid roomId, string type, string content) { Id = Guid.NewGuid(); OwnerId = ownerId; RoomId = roomId; Type = type; Content = content; Start = DateTime.Now; Stop = Start.AddMinutes(5); }
//public IEnumerable<SubEventInsertRule> GetSubEventInsertRules() //{ // return ((AssignmentType)Style).GetSubEventInsertRules(); //} public virtual void AdjustFromFinish(IEnumerable <Term> terms) { // aditional filter: item.Is<UnlaboredSubEvent>() || item.Is<Shrink>() var cells = terms.ConvertToCell(new DateRange(Start, End), 5, item => item.AsARest, null); cells.Loop(i => !cells[i], i => { From = Start.AddMinutes((i - 0) * 5); }); cells.LoopFromLast(i => !cells[i], i => Finish = Start.AddMinutes((i + 1) * 5)); }
/// <summary> /// Constructor for DateTimeEvent /// </summary> /// <param name="id">Internal identifier of the event</param> /// <param name="start">When the first occurence of the event will be</param> /// <param name="intervalMins">Time in minutes between occurrences of the event</param> /// <param name="rim">Have the event occur immediately after missing occurence(s) due to the service not running during the expected time</param> public DateTimeEvent(int id, DateTime start, int intervalMins, bool rim) : base(id) { DateTime st = start; if (st < DateTime.Now) { st = DateTime.Now; } Start = st; Next = Start.AddMinutes(intervalMins); IntervalMinutes = intervalMins; RunIfMissed = rim; }
/// <summary> /// AddSubEventInsertRule with checking IsCoverd, IsInTheRange /// </summary> /// <param name="rule"></param> /// <returns></returns> public virtual bool AddSubEventInsertRule(SubEventInsertRule rule) { //GetEnumerator(); rule.SetNewTime(Start.AddMinutes(rule.TimeRange.StartValue), default(DateTime)); if (!rule.IsInTheRange(Start, End)) { return(false); } if (_subEventInsertRules.Any(o => !ReferenceEquals(rule, o) && rule.IsCoverd(o))) { return(false); } _subEventInsertRules.Add(rule); _termSet.Clear(); _termSet.Add(this); SubEventInsertRules = _subEventInsertRules; return(true); }
public SimpleEvent(string start, string?end = null, string?title = null) { if (!DateTime.TryParse(new ReadOnlySpan <char>(start.ToCharArray()), out var startDateTime)) { throw new ArgumentException($"Value of parameter {nameof(start)} is not a valid DateTime string."); } Start = startDateTime; if (end == null) { End = Start.AddMinutes(Config.Events.DefaultDurationInMinutes); } else if (DateTime.TryParse(new ReadOnlySpan <char>(end.ToCharArray()), out var endDateTime)) { End = endDateTime; } else { throw new ArgumentException($"Value of parameter {nameof(end)} is not a valid DateTime string."); } Title = title ?? Config.Events.DefaultTitle; }
private DateTime?GetEstimateDone() { return(Start?.AddMinutes((ResourceGoal?.Quantity ?? 0.00) / (MiningRate ?? 1))); }
public void SetTimeToAnswer(int minutes) { Start = DateTime.Now.Date; Stop = Start.AddMinutes(minutes); }
public void MapStartTimes() { Start = DateTime.Today; End = DateTime.Today; switch (Number) { case 1: Start = Start.AddHours(8); Start = Start.AddMinutes(0); End = End.AddHours(9); End = End.AddMinutes(20); break; case 2: Start = Start.AddHours(9); Start = Start.AddMinutes(30); End = End.AddHours(10); End = End.AddMinutes(50); break; case 3: Start = Start.AddHours(11); Start = Start.AddMinutes(10); End = End.AddHours(12); End = End.AddMinutes(30); break; case 4: Start = Start.AddHours(12); Start = Start.AddMinutes(40); End = End.AddHours(14); End = End.AddMinutes(0); break; case 5: Start = Start.AddHours(14); Start = Start.AddMinutes(10); End = End.AddHours(15); End = End.AddMinutes(30); break; case 6: Start = Start.AddHours(15); Start = Start.AddMinutes(40); End = End.AddHours(17); End = End.AddMinutes(0); break; case 7: Start = Start.AddHours(17); Start = Start.AddMinutes(20); End = End.AddHours(18); End = End.AddMinutes(40); break; case 8: Start = Start.AddHours(18); Start = Start.AddMinutes(50); End = End.AddHours(20); End = End.AddMinutes(10); break; default: break; } }
protected MinuteTimeRange(int year, int month, int day, int hour, int minute, int minuteCount, ITimeCalendar calendar) : base(GetPeriodOf(year, month, day, hour, minute, minuteCount), calendar) { MinuteCount = minuteCount; EndMinute = Start.AddMinutes(MinuteCount).Minute; }