private void AddEditDayAvailability_Load(object sender, EventArgs e) { AvailabilityService aservice = new AvailabilityService(); var mostRecentIterationOfDay = aservice.AvailabilityForDay(EditedUserID, DayOfWeek, d: DateTime.Today); if(mostRecentIterationOfDay!=null) { tbNotes.Text = mostRecentIterationOfDay.Notes; dtpStartTime.Value = mostRecentIterationOfDay.StartTime; if (mostRecentIterationOfDay.FinishTime.HasValue) dtpEndTime.Value = mostRecentIterationOfDay.FinishTime.Value; } else { dtpStartDate.Value = DateTime.Now; } }
private void BuildButton( int day, StaffMemberDayAvailability b) { AvailabilityService aservice = new AvailabilityService(); if (day > 6) day = day % 7; b.Label = Enum.GetName(typeof(DayOfWeek), day); var s = ""; var item = aservice.AvailabilityForDay(EditedUserID, day, dateTimePicker1.Value); if(item!=null) { s += item.StartTime.ToShortTimeString() + (item.FinishTime.HasValue ? " - " + item.FinishTime.Value.ToShortTimeString() : "") + "\n"; } else { s += "No Availability Set"; } b.btnModify.Tag = day; b.rtbDetails.Text = s; }