private void ScheduleForConsultantRadioButton_CheckedChanged(object sender, EventArgs e)
        {
            this.ReportsTextBox.Hide();
            this.AppointmentsDataGridView.Show();
            this.consultantTextBox.Show();

            MySqlConnection con1 = new MySqlConnection(ConfigurationManager.ConnectionStrings["U04i5a"].ConnectionString);

            MySqlCommand cmd1 = new MySqlCommand("SELECT appointmentId, customerId, start, end FROM appointment", con1);

            con1.Open();
            MySqlDataAdapter adapter1 = new MySqlDataAdapter(cmd1);

            DataTable dt = new DataTable();

            adapter1.Fill(dt);
            AppointmentsDataGridView.DataSource = dt;

            AppointmentsDataGridView.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            con1.Close();

            AppointmentsDataGridView.ClearSelection();
            AppointmentsDataGridView.CurrentCell = null;

            AppointmentsDataGridView.Update();
            AppointmentsDataGridView.Refresh();
        }
Esempio n. 2
0
        private void CurrentWeekRadioButton_CheckedChanged(object sender, EventArgs e)
        {
            var nextWeek = DateTime.Now.AddDays(7).ToString("yyyy-MM-dd");

            //var today = DateTime.Now.Date.ToString("yyyy-MM-dd");

            String Query = "SELECT appointmentId, customerId, start, end, type FROM appointment WHERE start BETWEEN '" + today3 + "' AND '" + nextWeek + "';";

            MySqlConnection con1 = new MySqlConnection(ConfigurationManager.ConnectionStrings["U04i5a"].ConnectionString);
            MySqlCommand    cmd1 = new MySqlCommand(Query, con1);

            con1.Open();
            MySqlDataAdapter adapter1 = new MySqlDataAdapter(cmd1);

            DataTable ds1 = new DataTable();

            adapter1.Fill(ds1);
            AppointmentsDataGridView.DataSource = ds1;
            AppointmentsDataGridView.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            con1.Close();
            AppointmentsDataGridView.ClearSelection();
            AppointmentsDataGridView.CurrentCell = null;

            AppointmentsDataGridView.Update();
            AppointmentsDataGridView.Refresh();
        }