public void SetWeekDays() { StartDate = DateTime.Now.AddDays(-(((int)DateTime.Now.DayOfWeek)) - (int)DayOfWeek.Sunday).Date; StartDate = StartDate.Add(new TimeSpan(6, 0, 0)); EndDate = StartDate.AddDays(7).Date; EndDate = EndDate.Add(new TimeSpan(5, 59, 59)); }
private async Task SaveAction() { using (MarkBusy()) { BatLog.LogStart = StartDate.Add(StartTime).DateTime; await Db.SaveChangesAsync(); } GoBack(); }
public override void ApplyTimeOffset(TimeSpan offset) { StartDate = StartDate.Add(offset); EndDate = EndDate.Add(offset); foreach (DateStackStatsResult s in Stats) { s.Date = s.Date.Add(offset); } }
/// <summary> /// Shift the start date of the evetn /// </summary> /// <param name="shift">DateTime param</param> /// <exception cref="ArgumentNullException"></exception> public void ShiftEvent(TimeSpan shift) { if (shift != null) { StartDate = StartDate.Add(shift); } else { throw new ArgumentNullException(); } }
public void AddValidationErrors(CustomValidationContext context) { if (DateTime.Compare(StartDate.Add(StartTime), EndDate.Add(EndTime)) >= 0) { context.Results.Add(new ValidationResult("Data początkowa nie może być później niż końcowa!")); } if (DateTime.Compare(DateTime.Now, StartDate.Add(StartTime)) >= 0) { context.Results.Add(new ValidationResult("Data początkowa nie może być w przeszłości!")); } if (HasAccomodationBooked && String.IsNullOrEmpty(AccomodationId)) { context.Results.Add(new ValidationResult($"Brak Id dla miejsca zakwaterowania!")); } if (PreferedTravelModes == null || PreferedTravelModes.Count == 0) { context.Results.Add(new ValidationResult("Brak preferowanych środków transportu!")); } }
public override void ApplyTimeOffset(TimeSpan offset) { StartDate = StartDate.Add(offset); EndDate = EndDate.Add(offset); //foreach (var r in MostFrequent.Results) { // r.FirstOccurrence = r.FirstOccurrence.Add(offset); // r.LastOccurrence = r.LastOccurrence.Add(offset); //} //foreach (var r in MostRecent.Results) { // r.FirstOccurrence = r.FirstOccurrence.Add(offset); // r.LastOccurrence = r.LastOccurrence.Add(offset); //} foreach (DateProjectStatsResult s in Stats) { s.Date = s.Date.Add(offset); } }
/// <summary> /// Checks whether the given time intersects with this entry. /// </summary> /// <param name="timeToTest"></param> /// <returns></returns> protected override bool Clash(DateTime timeToTest) { DateTime testTime = (Options & ScheduleEntryOptions.EVETime) != 0 ? timeToTest.ToUniversalTime() : timeToTest; ScheduleDateTimeRange range = GetRangeForDay(testTime.Date); if (range == null) { return(false); } DateTime startDate = StartDate.Add(range.From.TimeOfDay); // in the event m_endDate is set to Forever (DateTime.MaxValue) we can't add anything to it DateTime endDate = EndDate == DateTime.MaxValue ? EndDate : EndDate.Add(range.From.TimeOfDay); if (startDate < testTime && testTime < endDate) { return(range.From < testTime && testTime < range.To); } return(false); }
public ReservationRequest(ReservationDto res) { if (DateTime.TryParse(res.StartDate, out DateTime startDate)) { StartDate = startDate; } else { throw new Exception($"StartDate parameter cannot be converted: '{res.StartDate}'"); } if (TimeSpan.TryParse(res.StartTime, out TimeSpan fromTime)) { FromTime = StartDate.Add(fromTime); } else { throw new Exception($"StartTime parameter cannot be converted: '{res.StartTime}'"); } if (TimeSpan.TryParse(res.EndTime, out TimeSpan toTime)) { ToTime = StartDate.Add(toTime); } else { throw new Exception($"EndTime parameter cannot be converted: '{res.EndTime}'"); } Duration = new TimeSpan(0, res.Duration, 0); Type = res.Type; Login = res.Email; Password = res.Password; Exclude = res.Exclude; }
public DateTime GetStudySessionStart() { return(StartDate.Add(StartTime)); }
public DateTime GetTimeAtPoint(RoutePoint point) { return(StartDate.Add(Route.StartTime).Add(point.FromStartTime)); }
public Termin ToTermin(string SchulungGUID) { return(new Termin { SchulungGUID = SchulungGUID, Start = StartDate.Add(StartTime), End = EndDate.Add(EndTime) }); }