Exemplo n.º 1
0
        public void LoginAsHeadOfDepartment(DataSet dataSet)
        {
            //HeadOfDepartment headOfDepartment = HeadOfDepartment.Instance;
            AbstractFactory  employeeFactory  = FactoryProducer.getFactory("EmployeeFactory");
            HeadOfDepartment headOfDepartment = (HeadOfDepartment)employeeFactory.getEmployee(
                "HeadOfDepartment");

            headOfDepartment.FirstName = dataSet.Tables[0].Rows[0].ItemArray[0].ToString();
            headOfDepartment.LastName  = dataSet.Tables[0].Rows[0].ItemArray[1].ToString();
            headOfDepartment.Id        = dataSet.Tables[0].Rows[0].ItemArray[2].ToString();
            headOfDepartment.Age       = Convert.ToInt16(dataSet.Tables[0].Rows[0].ItemArray[3].ToString());
            headOfDepartment.Username  = dataSet.Tables[0].Rows[0].ItemArray[4].ToString();
            headOfDepartment.Password  = dataSet.Tables[0].Rows[0].ItemArray[5].ToString();
            HeadOfDepartment_Form secretary_form = new HeadOfDepartment_Form(this.loginForm);

            secretary_form.ShowDialog();
        }
Exemplo n.º 2
0
        public void LoginAsSecretary(DataSet dataSet)
        {
            //SecretaryFolder.Secretary secretary = new SecretaryFolder.Secretary();
            AbstractFactory employeeFactory = FactoryProducer.getFactory("EmployeeFactory");
            Secretary       secretary       = (Secretary)employeeFactory.getEmployee("Secretary");

            secretary.FirstName = dataSet.Tables[0].Rows[0].ItemArray[0].ToString();
            secretary.LastName  = dataSet.Tables[0].Rows[0].ItemArray[1].ToString();
            secretary.Id        = dataSet.Tables[0].Rows[0].ItemArray[2].ToString();
            secretary.Age       = Convert.ToInt16(dataSet.Tables[0].Rows[0].ItemArray[3].ToString());
            secretary.Username  = dataSet.Tables[0].Rows[0].ItemArray[4].ToString();
            secretary.Password  = dataSet.Tables[0].Rows[0].ItemArray[5].ToString();

            /*MessageBox.Show("Logged in as Secretary:\n"+
             *  "Secretary FirstName: " + secretary.FirstName + "\n" +
             *  "Secretary Last Name: " + secretary.LastName + "\n" +
             *  "Secretary ID: " + secretary.Id);*/

            Secretary_Form secretary_form = new Secretary_Form(this.loginForm);

            secretary_form.ShowDialog();
        }
Exemplo n.º 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();
        }
Exemplo n.º 4
0
        public void LoginAsTeachingAssistant(DataSet dataSet)
        {
            //TeachingAssistant teachingAssist = new TeachingAssistant();
            AbstractFactory   employeeFactory = FactoryProducer.getFactory("EmployeeFactory");
            TeachingAssistant teachingAssist  = (TeachingAssistant)
                                                employeeFactory.getEmployee("TeachingAssistant");

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

            try
            {
                teachingAssist.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
                {
                    teachingAssist.HoursToTeach = new DateTime[2];
                }
                catch (Exception e)
                {
                    e.ToString();
                }
                teachingAssist.HoursToTeach[0] = new DateTime(2000, 1, 1, tempHoursToTeach[0].Hour, tempHoursToTeach[0].Minute, 0);
                teachingAssist.HoursToTeach[1] = new DateTime(2000, 1, 1, tempHoursToTeach[1].Hour, tempHoursToTeach[1].Minute, 0);
            }
            catch (Exception e) { e.ToString(); }

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

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

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

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

            try
            {
                teachingAssist.OfficeHoursTo = ParseDateTimeFromSql(dataSet.Tables[0].Rows[0].ItemArray[13].ToString());
            }
            catch (Exception e) { e.ToString(); }

            TeachingAssist_Form teachingAssistant_form = new TeachingAssist_Form(ref teachingAssist, this.loginForm);

            teachingAssistant_form.ShowDialog();
            //this.loginForm.Hide();
        }