Я составляю таблицу на каждую неделю каждого месяца 2019 года. Итак, просмотр календаря на неделю. Теперь я хочу сделать новые ячейки для событий календаря в определенное время. Я пытаюсь сделать клетку несколько раз. Например, событие на 8:00, одно на 8:30, одно на 9:00 и так далее.
<table class="table table-bordered table-striped" id="reservationCalendar" align="center" frame="border" style="width:100%">
<tr>
@{
int currentMonth = DateTime.Now.Month;
<td style="width:14%"></td>
for (int month = 0; month < 12; month++)
{
int currentYear = DateTime.Now.Year;
DateTime firstDay = new DateTime(DateTime.Now.Year, currentMonth, 1);
int daysInCurrentMonth = DateTime.DaysInMonth(firstDay.Year, firstDay.Month);
DateTime lastDay = new DateTime(currentYear, currentMonth, daysInCurrentMonth);
// Sunday casted to int gives 0 but that will not work for us, we need 7 to be able to calculate number of empty cells correctly
int dayOfWeekFirst = ((int)firstDay.DayOfWeek > 0) ? (int)firstDay.DayOfWeek : 7;
int dayOfWeekLast = ((int)lastDay.DayOfWeek > 0) ? (int)lastDay.DayOfWeek : 7;
for (int i = 1; i <= daysInCurrentMonth; i++)
{
DateTime renderedDay = new DateTime(firstDay.Year, firstDay.Month, i);
String DayDate = renderedDay.ToString("dd.MM.yyyy");
if (renderedDay < DateTime.Now)
{
<td class="alert alert-danger" width:14%">@renderedDay.DayOfWeek, @DayDate</td>
}
else
{
<td class="alert alert-success" style="width:14%">@renderedDay.DayOfWeek, @DayDate</td>
}
if (renderedDay.DayOfWeek == DayOfWeek.Sunday)
{
@: </tr>
@:</table>
@:<table class="table table-bordered table-striped" id="reservationCalendar" align="center" frame="border" style="width:100%">
@:<tr>
}
}
currentMonth = currentMonth + 1;
}
}
</tr>
</table>
Цель состояла бы в том, чтобы иметь событие для каждого раза в каждый день. С «столбцом времени слева». Спасибо за любой вклад или идеи:)