// Button 'Week' in the room section // Display room reservation for this week private void buttonDisplayRoomWeek_Click(object sender, EventArgs e) { // Find this weeks start date and convert to readable format for MySQL DateTime datefrom = CalculateDate.GetFirstDayOfWeek(DateTime.Today); DateTime dateto = datefrom.AddDays(7); // Fetch dataset DataSet roomreservationDS = DBGetData.GetRoomBookingDGVBetweenDates(datefrom, dateto); if (roomreservationDS != null) { // No tables fetched if (roomreservationDS.Tables.Count == 0) { new StatusMessage("No datatable found, contact administrator."); return; } // No rows fetched else if (roomreservationDS.Tables[0].Rows.Count == 0) { new StatusMessage("No datarows found for this week."); return; } // Clear labelStatus for previous messages else { new StatusMessage(""); } // Set the dataset as source for datagridview and make sure its displayed dataGridViewRoom.DataSource = roomreservationDS; dataGridViewRoom.DataMember = "Get_RR_BetweenDates"; LoadDataGridViewRoom(); } }
// // Room section // // Default room display (monthly) public void DisplayDefaultRoom() { // Find this weeks start date and convert to readable format for MySQL DateTime today = DateTime.Today; DateTime datefrom = new DateTime(today.Year, today.Month, 1); DateTime dateto = datefrom.AddMonths(1).AddDays(-1); // Fetch dataset DataSet roomreservationDS = DBGetData.GetRoomBookingDGVBetweenDates(datefrom, dateto); if (roomreservationDS != null) { // No tables fetched if (roomreservationDS.Tables.Count == 0) { new StatusMessage("No datatable found, contact administrator."); return; } // No rows fetched else if (roomreservationDS.Tables[0].Rows.Count == 0) { new StatusMessage("No datarows found for this month."); return; } // Clear labelStatus for previous messages else { new StatusMessage(""); } // Set the dataset as source for datagridview and make sure its displayed dataGridViewRoom.DataSource = roomreservationDS; dataGridViewRoom.DataMember = "Get_RR_BetweenDates"; LoadDataGridViewRoom(); } }