private void deleteCourse_button_Click(object sender, EventArgs e)
        {
            if (listView.SelectedItems.Count == 0)
            {
                MessageBox.Show("No course was selected.");
                return;
            }
            else if (listView.SelectedItems.Count > 1)
            {
                MessageBox.Show("Choose only one course to delete at the time.");
                return;
            }
            HeadOfDepartmentSQL headOfDepartmentSql = new HeadOfDepartmentSQL(this.sqlConnection);
            int courseID;

            try
            {
                courseID = Convert.ToInt16(this.listView.SelectedItems[0].SubItems[0].Text);
            }
            catch (Exception errorMsg)
            {
                MessageBox.Show(errorMsg.Message);
                return;
            }
            headOfDepartmentSql.DeleteCourse(courseID);
            CourseSQL.LoadCoursesToListView(ref this.listView);
        }
 public ExeptionOfHours_Form()
 {
     InitializeComponent();
     this.sqlConnection  = SQLConnection.GetSqlConnection();
     headOfDepartmentSQL = new HeadOfDepartmentSQL(sqlConnection);
     headOfDepartmentSQL.LoadPeopleWithExeptionRequestListView(ref this.listView);
 }
        private void Edit_Worker_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count == 0)
            {
                MessageBox.Show("No worker was selected.");
                return;
            }
            else if (listView1.SelectedItems.Count > 1)
            {
                MessageBox.Show("Choose only one worker to delete at the time.");
                return;
            }
            HeadOfDepartmentSQL sql  = new HeadOfDepartmentSQL(SQLConnection.GetSqlConnection());
            BasicUser           temp = new BasicUser();

            temp.FirstName = listView1.SelectedItems[0].SubItems[0].Text;
            temp.LastName  = listView1.SelectedItems[0].SubItems[1].Text;
            temp.Id        = listView1.SelectedItems[0].SubItems[2].Text;
            temp.Age       = int.Parse(listView1.SelectedItems[0].SubItems[3].Text);
            temp.Username  = listView1.SelectedItems[0].SubItems[4].Text;
            String id = temp.Id;
            BasicUser_Registration_Form regForm = new BasicUser_Registration_Form(ref temp, false);

            regForm.FormClosed += new FormClosedEventHandler(FormClosedHandling);
            regForm.ShowDialog();
            sql.UpdateWorker(id, job, temp);
            listView1.Items.Clear();
            sql.LoadAllPeopleInListView(ref this.listView1, job);
        }
Example #4
0
 public PeopleWithAbnormalHours_Form(int isIncrease)
 {
     InitializeComponent();
     this.sqlConnection  = SQLConnection.GetSqlConnection();
     headOfDepartmentSQL = new HeadOfDepartmentSQL(sqlConnection);
     headOfDepartmentSQL.LoadPeopleWithAbnormalHoursListView(ref this.listView, isIncrease);
 }
Example #5
0
        public PrintAllLecturer()
        {
            InitializeComponent();
            headOfDeptSQL = new HeadOfDepartmentSQL(SQLConnection.GetSqlConnection());

            headOfDeptSQL.printAllLecturerListView(this.listView1);
            listView1.View = View.Details;
        }
        public PrintAllTeachingAssists()
        {
            InitializeComponent();
            headOfDeptSQL = new HeadOfDepartmentSQL(SQLConnection.GetSqlConnection());

            headOfDeptSQL.printAllTeachingAssistantsInListView(this.listView1);
            listView1.View = View.Details;
        }
        private void iTalk_Button_21_Click(object sender, EventArgs e)
        {
            String   courseName     = this.courseName_textBox.Text;
            int      yearTaught     = this.yearTaught_checkedListBox.SelectedIndex + 1;
            int      semesterTaught = this.semesterTaught_checkedListBox.SelectedIndex + 1;
            Semester semester;
            String   errorMsg = "";

            if (courseName.Length == 0)
            {
                errorMsg += "\n-No course name was entered.";
            }
            if (yearTaught_checkedListBox.SelectedItems.Count == 0)
            {
                errorMsg += "\n-No year was choosen.";
            }
            if (semesterTaught_checkedListBox.SelectedItems.Count == 0)
            {
                errorMsg += "\n-No semester was choosen.";
            }
            if (errorMsg.Length > 0)
            {
                MessageBox.Show("The following errors occured:" + errorMsg);
                return;
            }
            switch (semesterTaught)
            {
            case 1: semester = Semester.First;
                break;

            case 2: semester = Semester.Second;
                break;

            case 3: semester = Semester.Third;
                break;

            default: semester = Semester.First;
                break;
            }
            SqlConnection connection = SQLConnection.GetSqlConnection();

            if (connection == null)
            {
                MessageBox.Show("SQL connection hasn't been initialized or has been closed.");
                return;
            }
            HeadOfDepartmentSQL sql = new HeadOfDepartmentSQL(connection);

            //MessageBox.Show("Last Added Course ID= " + sql.GetLastAddedCourseID());
            sql.AddNewCourse(new Course(sql.GetLastAddedCourseID(), courseName, yearTaught, semester, false));
            this.Dispose();
        }
        private void Secretary_Click(object sender, EventArgs e)
        {
            this.Hide();
            Secretary secretary = new Secretary();

            secretary.FirstName = "empty";
            BasicUser temp = (BasicUser)secretary;
            BasicUser_Registration_Form regForm = new BasicUser_Registration_Form(ref temp, true);

            regForm.FormClosed += new FormClosedEventHandler(FormClosedHandling);
            regForm.ShowDialog();

            if (temp != null && temp.FirstName != "empty")
            {
                String tempt = "The new user details: FirstName:" + temp.FirstName + ", lastname:" + temp.LastName + ",password:"******"SecretaryTable");
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count == 0)
            {
                MessageBox.Show("No worker was selected.");
                return;
            }
            else if (listView1.SelectedItems.Count > 1)
            {
                MessageBox.Show("Choose only one worker to delete at the time.");
                return;
            }
            HeadOfDepartmentSQL headOfDepartmentSql = new HeadOfDepartmentSQL(SQLConnection.GetSqlConnection());
            String ID = listView1.SelectedItems[0].SubItems[2].Text;

            headOfDepartmentSql.DeleteWorker(ID, listView1.SelectedItems[0].SubItems[5].Text);
            listView1.Items.Clear();
            headOfDepartmentSql.LoadAllPeopleInListView(ref this.listView1, "TeachingAssistant");
            headOfDepartmentSql.LoadAllPeopleInListView(ref this.listView1, "Lecturer");
            //sql.LoadAllPeopleInListView(ref this.listView1, "Secretary");
        }
        public DeleteWorker_Form(String str)
        {
            job = str;
            InitializeComponent();
            HeadOfDepartmentSQL sql = new HeadOfDepartmentSQL(SQLConnection.GetSqlConnection());

            if (str == "TeachingAssistant")
            {
                this.DeleteWorker_button.Hide();
                sql.LoadAllPeopleInListView(ref this.listView1, "TeachingAssistant");
            }
            else if (str == "Lecturer")
            {
                this.DeleteWorker_button.Hide();
                sql.LoadAllPeopleInListView(ref this.listView1, "Lecturer");
            }
            else if (str == "Delete")
            {
                this.Edit_Worker.Hide();
                sql.LoadAllPeopleInListView(ref this.listView1, "TeachingAssistant");
                sql.LoadAllPeopleInListView(ref this.listView1, "Lecturer");
                //sql.LoadAllPeopleInListView(ref this.listView1, "Secretary");
            }
        }
Example #11
0
        private void iTalk_Button_21_Click(object sender, EventArgs e)
        {
            String errorMsg = "";

            if (courseName_textBox.Text.Length == 0)
            {
                errorMsg += "-No course name was entered.\n";
            }
            if (yearTaught_checkedListBox.SelectedItems.Count == 0)
            {
                errorMsg += "-No year was chosen.\n";
            }
            if (semesterTaught_checkedListBox.SelectedItems.Count == 0)
            {
                errorMsg += "-No semester was chosen.\n";
            }

            if (errorMsg.Length > 0)
            {
                MessageBox.Show("The following errors occured:\n" + errorMsg);
                return;
            }
            course.CourseName = this.courseName_textBox.Text;
            course.YearTaught = this.yearTaught_checkedListBox.SelectedIndex + 1;
            int semesterTaught = this.semesterTaught_checkedListBox.SelectedIndex + 1;

            switch (semesterTaught)
            {
            case 1:
                course.SemesterTaught = Semester.First;
                break;

            case 2:
                course.SemesterTaught = Semester.Second;
                break;

            case 3:
                course.SemesterTaught = Semester.Third;
                break;

            default:
                course.SemesterTaught = Semester.First;
                break;
            }

            MessageBox.Show("Course name = " + course.CourseName + "\n" +
                            "Year Taught = " + course.YearTaught + "\n" +
                            "SemesterTaught = " + course.SemesterTaught);
            SqlConnection connection = SQLConnection.GetSqlConnection();

            if (connection == null)
            {
                MessageBox.Show("SQL connection hasn't been initialized or has been closed.");
                return;
            }
            HeadOfDepartmentSQL sql = new HeadOfDepartmentSQL(connection);

            //MessageBox.Show("Last Added Course ID= " + sql.GetLastAddedCourseID());
            sql.UpdateCourse(course);
            this.Close();
        }