コード例 #1
0
ファイル: Booking.cs プロジェクト: mariusnorheim/app2000v
        // Default hall display (monthly)
        public void DisplayDefaultHall()
        {
            // 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 hallreservationDS = DBGetData.GetHallBookingsBetweenDates(datefrom, dateto);

            if (hallreservationDS != null)
            {
                // No tables fetched
                if (hallreservationDS.Tables.Count == 0)
                {
                    new StatusMessage("No datatable found, contact administrator.");
                    return;
                }
                // No rows fetched
                else if (hallreservationDS.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
                dataGridViewHall.DataSource = hallreservationDS;
                dataGridViewHall.DataMember = "Get_HR_BetweenDates";
                LoadDataGridViewHall();
            }
        }