Example #1
0
        //If all practitioners radio button was changed
        private void all_practitioner_radio_CheckedChanged(object sender, EventArgs e)
        {
            //If the radio button is checked
            if (all_practitioner_radio.Checked == true)
            {
                //Clear chart
                chart.Series["Work Hours"].Points.Clear();
                //Change title
                chart_title.Text = "Practitioners work hours";

                int amountOfPractitioners;
                //Get table containing all the practitioners
                DataSet practitionersDS = SqlWorker.GetDataSet("Select * from Users where type='Practitioner'");
                amountOfPractitioners = SqlWorker.getAmountOfPractitioners();
                //Get work hours for each practitioner and put it on the chart
                for (int i = 0; i < amountOfPractitioners; i++)
                {
                    String name      = practitionersDS.Tables[0].Rows[i]["Name"].ToString();
                    String id        = practitionersDS.Tables[0].Rows[i]["ID"].ToString();
                    int    workHours = SqlWorker.getWorkHours(Convert.ToInt32(id), true, -1);
                    chart.Series["Work Hours"].Points.AddXY(name, workHours);
                }
                //Remove lables with zero values in the pie chart
                updatePieChart();
            }
        }
 //Constructor
 public Add_new_course()
 {
     InitializeComponent();
     this.Size = new Size(351, 375);
     if (SqlWorker.getAmountOfLecturers() > 1 && SqlWorker.getAmountOfPractitioners() > 1)
     {
         LecturerID_combo.DataSource        = SqlWorker.GetDataSet("SELECT * From Users Where type='Lecturer'").Tables[0];
         LecturerID_combo.DisplayMember     = "Name";
         practitionerID_combo.DataSource    = SqlWorker.GetDataSet("SELECT * From Users Where type='Practitioner'").Tables[0];
         practitionerID_combo.DisplayMember = "Name";
     }
     else
     {
         MessageBox.Show("There is no practitioners/lecturers in the system!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         this.Close();
     }
 }
Example #3
0
        //Ctor
        public Work_Hours()
        {
            InitializeComponent();
            //Fill comboboxes of lecturers and practitioners
            if (SqlWorker.getAmountOfLecturers() > 0 || SqlWorker.getAmountOfPractitioners() > 0)
            {
                chart_type_combo.SelectedIndex = 0;
                if (SqlWorker.getAmountOfLecturers() > 0)
                {
                    lecturers_combo.DataSource    = SqlWorker.GetDataSet("SELECT * From Users Where type='Lecturer'").Tables[0];
                    lecturers_combo.DisplayMember = "Name";
                    lecturers_combo.SelectedIndex = 0;
                }
                else
                {
                    All_lectures_radio.Enabled = false;
                    Lecturer_radio.Enabled     = false;
                    lecturers_combo.Enabled    = false;
                }
                if (SqlWorker.getAmountOfPractitioners() > 0)
                {
                    practitioner_combo.DataSource    = SqlWorker.GetDataSet("SELECT * From Users Where type='Practitioner'").Tables[0];
                    practitioner_combo.DisplayMember = "Name";
                    practitioner_combo.SelectedIndex = 0;
                }
                else
                {
                    all_practitioner_radio.Enabled = false;
                    practitioner_radio.Enabled     = false;
                    practitioner_combo.Enabled     = false;
                }
            }
            else
            {
                MessageBox.Show("There is no practitioners/lecturers in the system!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
            }

            All_lectures_radio.Checked = true;
        }