private void Lecturer_Menu_Click(object sender, EventArgs e)
        {
            Lecturer          lecturer       = new Lecturer();
            TeachingAssistant teachingAssist = new TeachingAssistant();

            this.lecturerForm = new Lecturer_Form(ref lecturer, null);//, ref teachingAssist);
            this.Hide();
            lecturerForm.FormClosed += new FormClosedEventHandler(lecturerForm_FormClosed);
            lecturerForm.ShowDialog();
        }
 private void lecturerForm_FormClosed(object sender, FormClosedEventArgs e)
 {
     this.lecturerForm.Close();
     this.lecturerForm = null;
     this.Show();
 }
Exemple #3
0
        public void LoginAsLecturer(DataSet dataSet)
        {
            //Lecturer lecturer = new Lecturer();
            AbstractFactory employeeFactory = FactoryProducer.getFactory("EmployeeFactory");
            Lecturer        lecturer        = (Lecturer)employeeFactory.getEmployee("Lecturer");

            lecturer.FirstName = dataSet.Tables[0].Rows[0].ItemArray[0].ToString();
            lecturer.LastName  = dataSet.Tables[0].Rows[0].ItemArray[1].ToString();
            lecturer.Id        = dataSet.Tables[0].Rows[0].ItemArray[2].ToString();
            lecturer.Age       = Convert.ToInt16(dataSet.Tables[0].Rows[0].ItemArray[3].ToString());
            lecturer.Username  = dataSet.Tables[0].Rows[0].ItemArray[4].ToString();
            lecturer.Password  = dataSet.Tables[0].Rows[0].ItemArray[5].ToString();
            try
            {
                lecturer.CoursesToTeach = ParseCoursesToTeachFromSql(dataSet.Tables[0].Rows[0].ItemArray[6].ToString());
            }
            catch (Exception e) { e.ToString(); }

            try
            {
                lecturer.DaysToTeach = ParseDaysToTeachFromSql(dataSet.Tables[0].Rows[0].ItemArray[7].ToString());
            }
            catch (Exception e) { e.ToString(); }
            // -------------------------------------------------------------------
            try
            {
                DateTime[] tempHoursToTeach = ParseHoursToTeachFromSql(dataSet.Tables[0].Rows[0].ItemArray[8].ToString());
                try
                {
                    lecturer.HoursToTeach = new DateTime[2];
                }
                catch (Exception e)
                {
                    e.ToString();
                }
                lecturer.HoursToTeach[0] = new DateTime(2000, 1, 1, tempHoursToTeach[0].Hour, tempHoursToTeach[0].Minute, 0);
                lecturer.HoursToTeach[1] = new DateTime(2000, 1, 1, tempHoursToTeach[1].Hour, tempHoursToTeach[1].Minute, 0);
            }
            catch (Exception e) { e.ToString(); }

            // -------------------------------------------------------------------
            try
            {
                lecturer.MinTimeBetweenClasses = Convert.ToInt16(dataSet.Tables[0].Rows[0].ItemArray[9].ToString());
            }
            catch (Exception e) { e.ToString(); }

            try
            {
                lecturer.NumOfDaysToTeach = Convert.ToInt16(dataSet.Tables[0].Rows[0].ItemArray[10].ToString());
            }
            catch (Exception e) { e.ToString(); }

            try
            {
                lecturer.SemestersToTeach = ParseSemestersToTeachFromSql(dataSet.Tables[0].Rows[0].ItemArray[11].ToString());
            }
            catch (Exception e) { e.ToString(); }

            try
            {
                lecturer.OfficeHoursFrom = ParseDateTimeFromSql(dataSet.Tables[0].Rows[0].ItemArray[12].ToString());
            }
            catch (Exception e) { e.ToString(); }

            try
            {
                lecturer.OfficeHoursTo = ParseDateTimeFromSql(dataSet.Tables[0].Rows[0].ItemArray[13].ToString());
            }
            catch (Exception e) { e.ToString(); }
            TeachingAssistant temp          = new TeachingAssistant();
            Lecturer_Form     lecturer_form = new Lecturer_Form(ref lecturer, this.loginForm);

            lecturer_form.ShowDialog();
        }