private void FormClassroomDetails_Load(object sender, EventArgs e)
 {
     CodeLayer.Handler h = new CodeLayer.Handler();
     Project_Sce.CodeLayer.Classroom classroom = h.Get <Project_Sce.CodeLayer.Classroom>(new Project_Sce.CodeLayer.Classroom(this.labelClassName.Text, -1, new bool(), new bool()));
     if (classroom != null)
     {
         if (classroom.Projector)
         {
             this.labelIsProjector.Text      = "✔";
             this.labelIsProjector.ForeColor = Color.FromArgb(0, 255, 0);
         }
         if (classroom.Computer)
         {
             this.labelIsComputer.Text      = "✔";
             this.labelIsComputer.ForeColor = Color.FromArgb(0, 255, 0);
         }
         this.label1.Text = classroom.SeatsNum.ToString();
         DataTable dt = h.GetDataTable <Project_Sce.CodeLayer.Lesson>(new Project_Sce.CodeLayer.Lesson(null, this.labelClassName.Text, null, null, null, -1, -1));
         dataGridView1.DataSource = dt;
     }
     else
     {
         MessageBox.Show("Error, can't get this class from database.");
     }
 }
        private void buttonSave_Click(object sender, EventArgs e)
        {
            CodeLayer.Handler h     = new CodeLayer.Handler();
            Course            cours = new Project_Sce.CodeLayer.Course(this.textBoxID.Text, this.nameTextBox.Text, Convert.ToInt32(this.hoursPerWkTextBox.Text), (float)Convert.ToDouble(this.pointTextBox.Text), this.categoryTextBox.Text, this.practitionCheckBox.Checked, this.labCheckBox.Checked, this.semesterTextBox.Text, Convert.ToInt32(this.yearTextBox.Text), this.registerOptionCheckBox.Checked);

            //Insert into DataBase Coursees table
            if (h.Update <Course>(cours))
            {
                MessageBox.Show("The cours ID " + cours.ID + " was successful updated.");
                this.parent.RefreshDataSource();
                this.Close();
            }
            else
            {
                MessageBox.Show("An error accrued when updating this cours, please try again.");
            }
        }
        private void buttonSubmit_Click(object sender, EventArgs e)
        {
            CodeLayer.Handler h = new CodeLayer.Handler();
            string            a = lIDTextBox.Text;
            var b  = this.dayComboBox.SelectedItem;
            int cc = System.Convert.ToInt32(this.comboBoxFromHour.SelectedItem);
            int d  = System.Convert.ToInt32(this.comboBoxFromHour.SelectedItem);
            int f  = System.Convert.ToInt32(this.comboBoxToHour.SelectedItem);

            Project_Sce.CodeLayer.Constraint c = new Project_Sce.CodeLayer.Constraint(lIDTextBox.Text, dayComboBox.SelectedItem.ToString(), System.Convert.ToInt32(comboBoxFromHour.SelectedItem), System.Convert.ToInt32(comboBoxToHour.SelectedItem));
            if (h.Add <Project_Sce.CodeLayer.Constraint>(c))
            {
                //ok
                this.Close();
                System.Threading.Thread th = new System.Threading.Thread(GoBack);
                th.SetApartmentState(System.Threading.ApartmentState.STA);
                th.Start();
            }
            else
            {
                //not ok
            }
        }